Class AddressesApiV2Controller
Provides a gateway to the AddressBookService which handles the shop address resources.
category |
System |
---|---|
package |
ApiV2Controllers |
__construct(\Slim\Slim $api, array $uri)
Call this constructor from every child controller class in order to set the Slim instance and the request routes arguments to the class.
deprecated |
The "__initialize" method will is deprecated and will be removed in a future version. Please use the new "init" for bootstrapping your child API controllers. |
---|---|
Throws |
|
\Slim\Slim
Slim framework instance, used for request/response manipulation.
array
This array contains all the segments of the current request, starting from the resource.
delete()
apiVersion |
2.1.0 |
---|---|
apiName |
DeleteAddress |
apiGroup |
Addresses |
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). |
apiExample |
{curl} Delete Address with ID = 811 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/addresses/811 |
apiSuccessExample |
{json} Success-Response { "code": 200, "status": "success", "action": "delete", "addressId": 811 } |
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." } |
get()
apiVersion |
2.1.0 |
---|---|
apiName |
GetAddress |
apiGroup |
Addresses |
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 |
apiSuccess |
Response-Body If successful, this method will return the address resource in JSON format. |
getCallableResource( $controller, array $mappedURI, \Slim\Slim $api)
array
\Slim\Slim
post()
apiVersion |
2.2.0 |
---|---|
apiName |
CreateAddress |
apiGroup |
Addresses |
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 } |
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. |
apiSuccess |
(Success 201) Response-Body If successful, this method returns a complete Customers resource in the response body. |
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." } |
put()
apiVersion |
2.1.0 |
---|---|
apiName |
UpdateAddress |
apiGroup |
Addresses |
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" } |
apiSuccess |
Response-Body If successful, this method returns the updated address resource in the response body. |
DEFAULT_PAGE_ITEMS
var |
---|
DEFAULT_CONTROLLER_NAME
var |
---|
DEFAULT_RATE_LIMIT
var |
---|
DEFAULT_RATE_RESET_PERIOD
var |
---|