Class HttpApiV2Controller
Contains common functionality for all the GX2 APIv2 controllers. You can use the $api instance in the child-controllers in order to gain access to request and response information. The $uri variable is an array that contains the requested resource path.
You can use a protected "__initialize" method in your child controllers for performing common operations without overriding the parent constructor method.
This class contains some private methods that define the core operations of each controller and should not be called from a child-controller (like validation, authorization, rate limiting). The only way to disable the execution of these methods is to override the controller.
package |
Default |
---|
__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.5.0 |
---|---|
apiName |
DeleteCustomerGroups |
apiGroup |
CustomerGroups |
apiDescription |
Removes a customer groups record from the system. This method will always return success even if the customer group does not exist. |
apiExample |
{curl} Delete CustomerGroups with ID = 84 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/customer_groups/84 |
apiSuccessExample |
{json} Success-Response { "code": 200, "status": "success", "action": "delete", "customerGroupId": 84 } |
get()
apiVersion |
2.5.0 |
---|---|
apiName |
GetCustomerGroups |
apiGroup |
CustomerGroups |
apiDescription |
Get multiple or a single customer groups record through the GET method |
apiExample |
{curl} Get All CustomerGroups records curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/customer_groups {curl} Get CustomerGroups record With ID = 982 curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/customer_groups/982 |
apiError |
400-BadRequest CustomerGroups data were not provided or customer groups record ID was not provided or is invalid. 404-NotFound CustomerGroups record could not be found. |
apiErrorExample |
Error-Response (Missing or invalid ID) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "CustomerGroups record ID was not provided or is invalid." } Error-Response (CustomerGroups Not Found) HTTP/1.1 404 Not Found { "code": 404, "status": "error", "message": "CustomerGroups record could not be found." } |
getCallableResource( $controller, array $mappedURI, \Slim\Slim $api)
array
\Slim\Slim
patch()
apiVersion |
2.5.0 |
---|---|
apiName |
UpdateCustomerGroups |
apiGroup |
CustomerGroups |
apiDescription |
Use this method if you want to update an existing customer groups record. |
apiParamExample |
{json} CustomerGroups entity { "names": { "EN": "Kids", "DE": "Kinder" }, "settings": { "public": false, "otDiscountFlag": false, "graduatedPrices": false, "showPrice": true, "showPriceTax": false, "addTaxOt": false, "discountAttributes": false, "fsk18Purchasable": false, "fsk18": false, "fsk18Display": false, "writeReviews": false, "readReviews": false }, "configurations": { "minOrder": 2.50, "maxOrder": 20.00, "discount": 0.5, "otDiscount": 0, "unallowedPaymentModules": [ "paypal", "cod", "moneyorder" ], "unallowedShippingModules": [ "selfpickup" ] } } |
apiParam |
{Object} names Object with language code as keys and name as values. {Object} settings Object with customer group settings, visit the example for further information. {Object} configurations Object with customer group configurations, visit the example for further information. |
apiSuccess |
(200) Request-Body If successful, this method returns the complete customerGroups resource in the response body. |
apiSuccessExample |
{json} Success-Response { "id": 2, "names": { "EN": "Kids", "DE": "Kinder" }, "settings": { "public": false, "otDiscountFlag": false, "graduatedPrices": false, "showPrice": true, "showPriceTax": false, "addTaxOt": false, "discountAttributes": false, "fsk18Purchasable": false, "fsk18": false, "fsk18Display": false, "writeReviews": false, "readReviews": false }, "configurations": { "minOrder": 2.50, "maxOrder": 20.00, "discount": 0.5, "otDiscount": 0, "unallowedPaymentModules": [ "paypal", "cod", "moneyorder" ], "unallowedShippingModules": [ "selfpickup" ] } } |
apiError |
400-BadRequest CustomerGroups data were not provided or customerGroups record ID was not provided or is invalid. 404-NotFoundRequest CustomerGroups data were not provided or customerGroups record ID was not provided or is invalid. |
apiErrorExample |
Error-Response (Empty request body) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "CustomerGroups data were not provided." } Error-Response (Missing or invalid ID) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "CustomerGroups record ID was not provided or is invalid." } Error-Response (Entity not found) HTTP/1.1 400 Bad Request { "code": 404, "status": "error", "message": "Customer group entity was not found with provided id [ID]" } |
post()
apiVersion |
2.5.0 |
---|---|
apiName |
CreateCustomerGroups |
apiGroup |
CustomerGroups |
apiDescription |
This method enables the creation of a new CustomerGroups into the system. |
apiParamExample |
{json} CustomerGroups entity { "names": { "EN": "Kids", "DE": "Kinder" }, "settings": { "public": false, "otDiscountFlag": false, "graduatedPrices": false, "showPrice": true, "showPriceTax": false, "addTaxOt": false, "discountAttributes": false, "fsk18Purchasable": false, "fsk18": false, "fsk18Display": false, "writeReviews": false, "readReviews": false }, "configurations": { "minOrder": 2.50, "maxOrder": 20.00, "discount": 0.5, "otDiscount": 0, "unallowedPaymentModules": [ "paypal", "cod", "moneyorder" ], "unallowedShippingModules": [ "selfpickup" ] } } |
apiParam |
{Object} names Object with language code as keys and name as values. {Object} settings Object with customer group settings, visit the example for further information. {Object} configurations Object with customer group configurations, visit the example for further information. |
apiSuccess |
(201) Request-Body If successful, this method returns the complete customerGroups resource in the response body. |
apiSuccessExample |
{json} Success-Response { "id": 2, "names": { "EN": "Kids", "DE": "Kinder" }, "settings": { "public": false, "otDiscountFlag": false, "graduatedPrices": false, "showPrice": true, "showPriceTax": false, "addTaxOt": false, "discountAttributes": false, "fsk18Purchasable": false, "fsk18": false, "fsk18Display": false, "writeReviews": false, "readReviews": false }, "configurations": { "minOrder": 2.50, "maxOrder": 20.00, "discount": 0.5, "otDiscount": 0, "unallowedPaymentModules": [ "paypal", "cod", "moneyorder" ], "unallowedShippingModules": [ "selfpickup" ] } } |
apiError |
400-BadRequest The body of the request was empty. |
apiErrorExample |
Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "CustomerGroups data were not provided." } |
DEFAULT_PAGE_ITEMS
var |
---|
DEFAULT_CONTROLLER_NAME
var |
---|
DEFAULT_RATE_LIMIT
var |
---|
DEFAULT_RATE_RESET_PERIOD
var |
---|