Http Method | Resource | Description |
---|---|---|
POST | /Account/Login |
Logs a customer in.
For versions 15.6 or
higher this resource should only be used in conjunction with
the remaining session-based resources which use
|
POST | /Account/Logout | Logs a customer out. If the customer is not yet logged
in, the server returns an HTTP status 204, but nothing is done
on the server. If the customer is logged in, the server:
|
POST | /Account/Register | Creates a new customer account. The account is created
using the specified credentials and profile information. If the
action is successful, the customer is automatically logged in.
This action verifies the following:
|
GET | /Account/{Id} | If the customer is logged in, the server returns the account profile; for an anonymous customer, the server returns an empty result. |
PATCH | /Account/{Id} | Updates the account profile with the specified
information. The customer has to be logged in. The request must
include the If-Match header, which holds the last known
base-point information. The value of this header is an "ETag"
representing the account state received via a "Login",
"Register", "Get Account Profile," or previous "Update Account
Profile" request.
|
GET | /Account/{Id}/Addresses |
If a customer is logged in, the server returns an array containing up to 100 account addresses. The first address in the array is the preferred address. For an anonymous customer, the server returns an empty result. This will retrieve a pageable result. |
GET | /Account/{Id}/Addresses/{Address_name} | Returns an address of the currently logged in customer. |
PATCH | /Account/{Id}/Addresses/{Address_name} | Updates an address from a currently logged in customer. |
DELETE | /Account/{Id}/Addresses/{Address_name} | Deletes an address from the currently logged in account. |
PUT | /Account/{Id}/Addresses/{Address_name} | If a customer is logged in, the action creates a new customer address from the given document. If an address with the given name is already existent, this will completely overwrite the existing address. |
Logs a customer in.
For versions 15.6 or higher this resource should only be
used in conjunction with the remaining session-based resources which use
/account/login
for authentication, listed in the Shop API Overview. In
particular calling this resource has no impact on basket handling. To
transfer the ownership of a basket from an anonymous user to a registered
customer when using JWT, use the workflow
described here.
Url
POST https://hostname:port/dw/shop/v15_9/account/login
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Request Document
Response Document
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
401 |
UnauthorizedException
|
Indicates the username is unknown or the password does not match. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.afterLogin
|
afterLogin (profile : Profile , credentials : Credentials ) : Status The function is called after the customer was logged in and their basket was retrieved and recalculated.
|
dw.ocapi.shop.account.beforeLogin
|
beforeLogin (credentials : Credentials ) : Status The function is called before the credentials are checked.
|
Sample
REQUEST:
POST /dw/shop/v15_9/account/login HTTP/1.1
Host: example.com
Content-Type: application/json; charset=UTF-8
Content-Length: 67
{
"username":"[email protected]",
"password":"demandware1"
}
RESPONSE:
HTTP/1.1 200 OK
Date: Wed, 06 Nov 2013 11:02:00 GMT
Set-Cookie: dwsecuretoken_1f866598df3d23bd96d7fbc0ff91985f=r_GEV82PiN5hAqtaoTgI3Dwl8b-OYr29lQ==; Path=/; Secure; HttpOnly
Set-Cookie: dwsid=gUZvm6QnSXdxULMKeTBSfclwrRZQ-iF1F4HiGZJIkND7ZXYNIXHyFhIkBsbUl0uNZHIQXTnZdSHvzy3hmwqMvg==; path=/; HttpOnly
Cache-Control: no-cache,no-store,must-revalidate
ETag: 00df092fee8b583a3bfdc1d27074ab0f34c2c8e40fa17b1fb961be414bdd500e
Content-Type: application/json;charset=UTF-8
Content-Length: 502
{
"_v":"15.9",
"_type":"profile",
"birthday":"1900-01-01",
"company_name":"Demandware",
"customer_no":"S00000005",
"email":"[email protected]",
"fax":"781-756-3700",
"first_name":"Patricia",
"gender":"f",
"last_login_time":"2013-11-06T11:02:02.131Z",
"last_name":"Miller","last_visit_time":"2013-11-06T11:02:02.131Z",
"phone_business":"781-756-3700",
"phone_home":"123-456-789",
"phone_mobile":"123-456-789",
"previous_login_time":"2009-05-26T14:28:06.000Z",
"previous_visit_time":"2009-05-26T14:28:06.000Z",
"title":"Big Spender"
}
Logs a customer out. If the customer is not yet logged in, the server returns an HTTP status 204, but nothing is done on the server. If the customer is logged in, the server:
Url
POST https://hostname:port/dw/shop/v15_9/account/logout
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Sample
REQUEST:
POST /dw/shop/v15_9/account/logout HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==;
dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=acwoUwjMGdrNan1VP6HmIghWOJ
RESPONSE:
HTTP/1.1 204 No Content
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Set-Cookie: dwsid="oMGC7IlIkZRQnBx_F6eoA7sz3LzRFucdFo2nHMBNBy9Ma9tXT8ejJvlCKg1bnaKssZerzkhTTL2EgyPL9bzdjg==";Version=1;Path=/;Discard;HttpOnly
Set-Cookie: dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d="\"\"";Version=1;Path=/;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly
Set-Cookie: dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=bcdlZDxB7h5YakHw3p1ZTDPihp;Path=/;Expires=Wed, 04-Apr-2012 13:40:01 GMT
Creates a new customer account. The account is created using the specified credentials and profile information. If the action is successful, the customer is automatically logged in. This action verifies the following:
Url
POST https://hostname:port/dw/shop/v15_9/account/register
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Request Document
Response Document
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
400 |
InvalidPasswordException
|
Indicates the password does not match the password acceptance criteria. | |
400 |
InvalidUsernameException
|
Indicates the username does not match the username acceptance criteria. | |
400 |
InvalidMessageException
|
Indicates that a profile property does not match the profile attribute definition constraints. | |
400 |
UsernameAlreadyInUseException
|
Indicates the username is already in use. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.afterRegister
|
afterRegister (profile : Profile , registration : Registration ) : Status The function is called after the new profile was created.
|
dw.ocapi.shop.account.beforeRegister
|
beforeRegister (registration : Registration ) : Status The function is called before the new profile is created.
|
Sample
REQUEST:
POST /dw/shop/v15_9/account/register HTTP/1.1
Host: example.com
Content-Type: application/json; charset=UTF-8
{
"credentials":
{
"username":"foo",
"password":"bar"
},
"profile":
{
"email":"[email protected]",
"birthday":"2011-05-06",
"fax":"",
"first_name":"",
"gender":"m",
"job_title":"",
"last_name":"",
"phone_business":"",
"phone_home":"",
"phone_mobile":"",
"preferred_locale":"en-US",
"salutation":"",
"second_name":"",
"suffix":"",
"title":""
}
}
# in case of success:
RESPONSE:
HTTP/1.1 200 OK
Set-Cookie: dwsid="pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==";Version=1;Path=/;Discard;HttpOnly
Set-Cookie: dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d="5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==";Version=1;Path=/;Discard;Secure;HttpOnly
Set-Cookie: dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=acwoUwjMGdrNan1VP6HmIghWOJ;Path=/;Expires=Wed, 04-Apr-2012 13:40:01 GMT
Expires: Thu, 01-Jan-1970 00:00:00 GMT
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
"_v":"15.9",
"_type":"profile",
"email":"[email protected]",
"birthday":"2011-05-06",
"fax":"",
"first_name":"",
"gender":"m",
"job_title":"",
"last_name":"",
"phone_business":"",
"phone_home":"",
"phone_mobile":"",
"preferred_locale":"en-US",
"salutation":"",
"second_name":"",
"suffix":"",
"title":""
}
# in case of validation failure:
RESPONSE:
HTTP/1.1 400 BAD REQUEST
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type" : "fault",
"fault":{
"type":"InvalidProfileException",
"message":"Invalid profile."
}
}
If the customer is logged in, the server returns the account profile; for an anonymous customer, the server returns an empty result.
Url
GET https://hostname:port/dw/shop/v15_9/account/{id}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
id | String | The id (should be this) |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. |
Sample
REQUEST:
GET /dw/shop/v15_9/account/this HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==;
dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=acwoUwjMGdrNan1VP6HmIghWOJ
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
"_v":"15.9",
"_type":"profile",
"birthday":"",
"customer_no":12345,
"email":"[email protected]",
"fax":"987655321",
"first_name":"Dude",
"gender":"m",
"job_title":"Dr.",
"last_login_time":2011-04-11T00:00:00.000Z,
"last_name":"Lebowski",
"last_visit_time":2011-04-11T00:00:00.000Z,
"phone_business":"",
"phone_home":"",
"phone_mobile":"1234567890",
"preferred_locale":"en-US",
"previous_login_time":2011-04-11T00:00:00.000Z,
"previous_visit_time":2011-04-11T00:00:00.000Z,
"salutation":"",
"second_name":"",
"suffix":"",
"title":""
}
Updates the account profile with the specified information. The customer has to be logged in. The request must include the If-Match header, which holds the last known base-point information. The value of this header is an "ETag" representing the account state received via a "Login", "Register", "Get Account Profile," or previous "Update Account Profile" request.
Url
PATCH https://hostname:port/dw/shop/v15_9/account/{id}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Request Document
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
id | String | The id (should be this) |
Header Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
If-Match | String | the ETag header value contained in the server response |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
400 |
InvalidMessageException
|
Indicates that a profile property does not match the Profile attribute definition constraints. | |
401 |
UnauthorizedException
|
Indicates the customer is not logged-in, which is a precondition for updating a profile. | |
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.afterUpdate
|
afterUpdate (profile : Profile , update : Profile ) : Status The function is called after the profile was updated with update document.
|
dw.ocapi.shop.account.beforeUpdate
|
beforeUpdate (profile : Profile , update : Profile ) : Status The function is called before the profile is updated with update document.
|
Sample
REQUEST:
PATCH /dw/shop/v15_9/account/this HTTP/1.1
Host: example.com
If-Match: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==;
dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=acwoUwjMGdrNan1VP6HmIghWOJ
{
"_delete":["fax","phone_mobile"], // delete values of properties "fax" and "phone_mobile"
"birthday":"2011-05-06", // update "birthday"
"email":"[email protected]" // update "email"
}
# in case of success:
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
ETag: t9ccde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73b8h6 // the last known base-point that is used for PATCH update requests
{
"_v":"15.9",
"_type":"profile",
"birthday":"2011-05-06",
"customer_no":12345,
"email":"[email protected]",
"fax":"",
"first_name":"Dude",
"gender":"m",
"job_title":"",
"last_login_time":2011-04-11T00:00:00.000Z,
"last_name":"Lebowski",
"last_visit_time":2011-04-11T00:00:00.000Z,
"phone_business":"",
"phone_home":"",
"phone_mobile":"",
"preferred_locale":"en-US",
"previous_login_time":2011-04-11T00:00:00.000Z,
"previous_visit_time":2011-04-11T00:00:00.000Z,
"salutation":"",
"second_name":"",
"suffix":"",
"title":""
}
# in case of validation failure:
RESPONSE:
HTTP/1.1 400 BAD REQUEST
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
ETag: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
Content-Length: 47
{
"_v":"15.9",
"_type" : "fault",
"fault":{
"type":"InvalidProfileException",
"message":"Invalid profile."
}
}
}
If a customer is logged in, the server returns an array containing up to 100 account addresses. The first address in the array is the preferred address. For an anonymous customer, the server returns an empty result.
This will retrieve a pageable result.
Url
GET https://hostname:port/dw/shop/v15_9/account/{id}/addresses
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
id | String | The id (should be this) |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. |
Sample
REQUEST:
GET /dw/shop/v15_9/account/this/addresses HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==;
dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=acwoUwjMGdrNan1VP6HmIghWOJ
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type":"customer_address_result",
"count":2,
"total":2,
"data":
[{
"address1":"10 Somewhere St.",
"address2":"",
"address_id":"8461948625703718"
"address_name":"",
"city":"Boston",
"company_name":"",
"country_code":"",
"first_name":"Egon",
"full_name":"Egon Krenz",
"job_title":"",
"last_name":"Krenz",
"phone":"",
"postal_code":"",
"post_box":"",
"preferred":true,
"salutation":"",
"second_name":"",
"state_code":"",
"suffix":"",
"suite":"",
"title":""
},
...
]
}
Returns an address of the currently logged in customer.
Url
GET https://hostname:port/dw/shop/v15_9/account/{id}/addresses/{address_name}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
address_name | String | the unique name of the address to create | maxLength=256, minLength=1 |
id | String | the account ID, expected is 'this' | minLength=1 |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
401 |
NotLoggedInException
|
Indicates that the customer is not authenticated and must be logged in. | |
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. | |
404 |
NotFoundException
|
Indicates that the address with the given address name is not existent. |
Sample
REQUEST:
GET /dw/shop/v15_9/account/this/addresses/address_name HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
Etag: 851972d22598879fa14141572cd83f6650549848112c92a3c3e7331d3f784129
{
"_v":"15.9",
"_type":"customer_address",
"address1":"10 Somewhere St.",
"address2":"Some extension",
"address_id":"8461948625703718",
"address_name":address_name"",
"city":"Boston",
"company_name":"Company Inc.",
"country_code":"US",
"first_name":"Egon",
"full_name":"Egon Karl Krenz",
"job_title":"Master of Arts",
"last_name":"Krenz",
"phone":"0815-12345",
"postal_code":"98765",
"preferred":true,
"second_name":"Karl",
"state_code":"MA"
}
# in case of failure:
RESPONSE:
HTTP/1.1 404 Bad Request
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type" : "fault",
"fault":
{
"type":"NotFoundException",
"message":"No customer address 'address_name' in site 'SiteGenesis' found."
}
}
Updates an address from a currently logged in customer.
Url
PATCH https://hostname:port/dw/shop/v15_9/account/{id}/addresses/{address_name}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Request Document
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
address_name | String | the unique name of the address to create | maxLength=256, minLength=1 |
id | String | the account ID, expected is 'this' | minLength=1 |
Header Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
If-Match | String | the ETag header value contained in the server response |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
400 |
AddressNameAlreadyInUseException
|
Shows that the address name from the request document is already used for another address. | |
401 |
NotLoggedInException
|
Indicates that the customer is not authenticated and must be logged in. | |
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. | |
404 |
NotFoundException
|
Indicates that the address with the given address name is not existent. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.address.afterUpdate
|
afterUpdate (profile : Profile , customerAddress : CustomerAddress , update : CustomerAddress ) : Status The function is called after an account address was updated.
|
dw.ocapi.shop.account.address.beforeUpdate
|
beforeUpdate (profile : Profile , customerAddress : CustomerAddress , update : CustomerAddress ) : Status The function is called before an account address is updated with the given document.
|
Sample
REQUEST:
PATCH /dw/shop/v15_9/account/this/addresses/address_name HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==;
If-Match:851972d22598879fa14141572cd83f6650549848112c92a3c3e7331d3f784129
{
"_delete":["phone", "second_name"],
"address1":"42 Somewhere St."
}
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
Etag: 123452d22598879fa14141572cd83f6650549848112c92a3c3e7331d3f784129
{
"_v":"15.9",
"_type":"customer_address",
"address1":"42 Somewhere St.",
"address2":"Some extension",
"address_id":"8461948625703718"
"address_name":address_name"",
"city":"Boston",
"company_name":"Company Inc.",
"country_code":"US",
"first_name":"Egon",
"full_name":"Egon Krenz",
"job_title":"Master of Arts",
"last_name":"Krenz",
"postal_code":"98765",
"preferred":true,
"state_code":"MA"
}
# in case of failure:
RESPONSE:
HTTP/1.1 404 Bad Request
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type" : "fault",
"fault":
{
"type":"NotFoundException",
"message":"No customer address 'address_name' in site 'SiteGenesis' found."
}
}
Deletes an address from the currently logged in account.
Url
DELETE https://hostname:port/dw/shop/v15_9/account/{id}/addresses/{address_name}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
address_name | String | the unique name of the address to delete | maxLength=256, minLength=1 |
id | String | the account ID, expected is 'this' | minLength=1 |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
401 |
NotLoggedInException
|
Indicates that the customer is not authenticated and must be logged in. | |
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. | |
404 |
NotFoundException
|
Indicates that the address with the given address name is not existent. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.address.afterDelete
|
afterDelete (profile : Profile ) : Status The function is called after an account address was deleted.
|
dw.ocapi.shop.account.address.beforeDelete
|
beforeDelete (profile : Profile , address : CustomerAddress ) : Status The function is called before an account address is deleted with the given document.
|
Sample
REQUEST:
DELETE /dw/shop/v15_9/account/this/addresses/address_name HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==
# in case of success:
RESPONSE:
HTTP/1.1 204 No Content
# in case of failure:
RESPONSE:
HTTP/1.1 404 Requested resource not found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type" : "fault",
"fault":
{
"type":"NotFoundException",
"message":"No customer address 'address_name' in site 'SiteGenesis' found."
}
}
If a customer is logged in, the action creates a new customer address from the given document. If an address with the given name is already existent, this will completely overwrite the existing address.
Url
PUT https://hostname:port/dw/shop/v15_9/account/{id}/addresses/{address_name}
Formats
json, xml
Authentication
Name | Description |
---|---|
None | No authentication. |
Request Document
Response Document
Path Parameters
Parameter | Type | Description | Constraints |
---|---|---|---|
address_name | String | the unique name of the address to create | maxLength=256, minLength=1 |
id | String | the account ID, expected is 'this' |
In case of a failure Fault Document is returned.
Faults
Status | Type | Arguments | Description |
---|---|---|---|
401 |
NotLoggedInException
|
Indicates that the customer is not authenticated and must be logged in. | |
404 |
NotFoundException
|
Indicates the account was requested by any identifier other than 'this'. |
Customization
This Resource supports server-side customization.
Extension Point | Method Detail |
---|---|
dw.ocapi.shop.account.address.afterCreate
|
afterCreate (profile : Profile , customerAddress : CustomerAddress , create : CustomerAddress ) : Status The function is called after the new account address was created.
|
dw.ocapi.shop.account.address.beforeCreate
|
beforeCreate (profile : Profile , create : CustomerAddress ) : Status The function is called before an account address is created with the given document.
|
Sample
REQUEST:
PUT /dw/shop/v15_9/account/this/addresses/address_name HTTP/1.1
Host: example.com
Cookie: dwsid=pATvWUO3KSdt-Kmcy-8-RsxKnoO4BMDwoec7ACVlW6tZNnhaOL7gt7mHqL-h7QYn5TyE61z0DeSMCqxngsWeHw==;
dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==
{
"address1":"10 Somewhere St.",
"address2":"Some extension",
"city":"Boston",
"company_name":"Company Inc.",
"country_code":"US",
"first_name":"Egon",
"job_title":"Master of Arts",
"last_name":"Krenz",
"phone":"0815-12345",
"postal_code":"98765",
"preferred":true,
"second_name":"Karl",
"state_code":"MA"
}
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
Etag: 851972d22598879fa14141572cd83f6650549848112c92a3c3e7331d3f784129
{
"_v":"15.9",
"_type":"customer_address",
"address1":"10 Somewhere St.",
"address2":"Some extension",
"address_id":"8461948625703718",
"address_name":address_name"",
"city":"Boston",
"company_name":"Company Inc.",
"country_code":"US",
"first_name":"Egon",
"full_name":"Egon Karl Krenz",
"job_title":"Master of Arts",
"last_name":"Krenz",
"phone":"0815-12345",
"postal_code":"98765",
"preferred":true,
"second_name":"Karl",
"state_code":"MA"
}
# in case of failure:
RESPONSE:
HTTP/1.1 400 Bad Request
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
"_v":"15.9",
"_type" : "fault",
"fault":
{
"type":"NotLoggedInException",
"message":"Customer must be logged-in."
}
}