Class AddressesApiV2Controller
Class AddressesApiV2Controller
Provides a gateway to the AddressBookService which handles the shop address resources.
-
AbstractApiV2Controller
-
┗
HttpApiV2Controller
-
┗
AddressesApiV2Controller
Methods summary
protected
__initialize( void )
Initializes API Controller
Initializes API Controller
public
post( void )
Api
{post} /addresses Create Address
Apierror
400-BadRequest Address data were not provided.
Apierrorexample
Error-Response
HTTP/1.1 400 Bad Request
{
"code": 400,
"status": "error",
"message": "Address data were not provided."
}
Apigroup
Addresses
Apiname
CreateAddress
Apiparam
{int} customerId The customer's record ID to whom the address belong.
{string} gender Provide either "m" or "f" for male and female.
{string} company The address company name.
{string} firstname The address firstname.
{string} lastname The address lastname.
{string} street The address street.
{string} houseNumber The address house number.
{string} additionalAddressInfo Additional information about the address.
{string} suburb The address suburb.
{string} postcode The address postcode.
{string} city The address city.
{int} countryId Provide an existing "countryId", if it does not exist create it through the
"countries" API methods.
{int} zoneId Provide an existing "countryId", if it does not exist create it through the "zones" API
methods.
{string} class The address class can be any string used for distinguishing the address from other
records.
{bool} b2bStatus Defines the Business-to-Business status of the address.
Apiparamexample
{json} Request-Body
{
"customerId": 1,
"gender": "m",
"company": "Test Company",
"firstname": "John",
"lastname": "Doe",
"street": "Test Street",
"houseNumber": "123",
"additionalAddressInfo": "1. Etage",
"suburb": "Test Suburb",
"postcode": "23983",
"city": "Test City",
"countryId": 81,
"zoneId": 84,
"class": null,
"b2bStatus": false
}
Apisuccess
(Success 201) Response-Body If successful, this method returns a complete Customers resource in
the response body.
Apiversion
2.2.0
public
put( void )
Api
{put} /addresses/:id Update Address
Apidescription
Update an existing address record by providing new data. You do not have to provide the full
presentation of the address in the JSON string of the request, rather just the fields to be
updated. The address ID will be taken from the URI of the request so it is not required that
it is included withing the request JSON.
Apiexample
{json} Request-Body
{
"company": "Test Company - UPDATED",
"firstname": "John - UPDATED",
"lastname": "Doe - UPDATED",
"street": "Test Street - UPDATED",
"houseNumber": "1 - UPDATED",
"additionalAddressInfo": "1. Etage - UPDATED",
"suburb": "Test Suburb - UPDATED",
"city": "Test City - UPDATED"
}
Apigroup
Addresses
Apiname
UpdateAddress
Apisuccess
Response-Body If successful, this method returns the updated address resource in the response body.
Apiversion
2.1.0
public
delete( void )
Api
{delete} /addresses/:id Delete Address
Apidescription
Remove an address record from the system. This method will always return success even if the address record
does not exist (due to internal architecture decisions, which strive to avoid unnecessary failures).
Apierror
400-BadRequest Address record ID was not provided in the resource URL.
Apierrorexample
Error-Response
HTTP/1.1 400 Bad Request
{
"code": 400,
"status": "error",
"message": "Address record ID was not provided in the resource URL."
}
Apiexample
{curl} Delete Address with ID = 811
curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/addresses/811
Apigroup
Addresses
Apiname
DeleteAddress
Apisuccessexample
{json} Success-Response
{
"code": 200,
"status": "success",
"action": "delete",
"addressId": 811
}
Apiversion
2.1.0
public
get( void )
Api
{get} /addresses/:id Get Address
Apidescription
Get multiple or a single address records through a GET requets. This method supports all the GET parameters
that are mentioned in the "Introduction" section of this documentation.
Apiexample
{curl} Delete Address with ID = 243
curl --user admin@shop.de:12345 http://shop.de/api.php/v2/addresses/243
Apigroup
Addresses
Apiname
GetAddress
Apisuccess
Response-Body If successful, this method will return the address resource in JSON format.
Apiversion
2.1.0
_linkResponse(),
_locateResource(),
_mapResponse(),
_minimizeResponse(),
_paginateResponse(),
_searchResponse(),
_setJsonValue(),
_sortResponse(),
_writeResponse()
__construct(),
_prepareResponse(),
_setRateLimitHeader(),
_validateRequest()
Constants summary
DEFAULT_CONTROLLER_NAME,
DEFAULT_PAGE_ITEMS,
DEFAULT_RATE_LIMIT,
DEFAULT_RATE_RESET_PERIOD
Properties summary
$api,
$uri