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.
__initialize()
delete()
apiVersion |
2.4.0 |
---|---|
apiName |
DeleteOrderStatus |
apiGroup |
OrderStatus |
apiDescription |
Removes a order status record from the system. This method will always return success. |
apiExample |
{curl} Delete Order Status with ID = 2 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/order_statuses/2 |
apiSuccessExample |
{json} Success-Response { "code": 200, "status": "success", "action": "delete", "orderStatusId": 2 } |
get()
apiVersion |
2.4.0 |
---|---|
apiName |
GetOrderStatus |
apiGroup |
OrderStatus |
apiDescription |
Get a single order status entry. This method is currently limited to only fetching a single order status resource so make sure that you provide the order status ID in the request URI. |
apiExample |
{curl} Get all order statuses curl --user admin@shop.de:12345 http://shop.de/api.php/v2/order_statuses {curl} Get order status with ID = 2 curl --user admin@shop.de:12345 http://shop.de/api.php/v2/order_statuses/2 |
apiSuccess |
Response-Body If successful, this method will return the order status resource in JSON format. |
apiError |
(Error 5xx) 500-InternalError If the record is not found or something else goes wrong the API will return a 500 error status. Read the message for more info. (Error 4xx) 400-Bad Request If the ID is not numeric in the request URI then the API will return a 400 error status because it cannot return the order status resource. |
getCallableResource( $controller, array $mappedURI, \Slim\Slim $api)
array
\Slim\Slim
post()
apiVersion |
2.4.0 |
---|---|
apiName |
CreateOrderStatus |
apiGroup |
OrderStatus |
apiDescription |
This method creates a new order status in the database. |
apiExample |
{curl} Creates New Order Status curl -X POST --user admin@shop.de:12345 http://shop.de/api.php/v2/order_statuses |
apiParamExample |
{json} Create new order status { "names": { "EN": "new order status name", "DE": "neuer order status name" }, "color": "adad1313" } |
apiParam |
{object} names Language related order status names. Provide the language id as object key. {string} color Label color of order status. |
apiSuccess |
(Success 201) Response-Body If successful, this method returns the created order status resource in the response body. |
apiError |
400-Bad Request The API will return this status code if the order status data was not provided. |
put()
apiVersion |
2.4.0 |
---|---|
apiName |
UpdateOrderStatus |
apiGroup |
OrderStatus |
apiDescription |
This method updates a order status in the database. |
apiExample |
{curl} Update Order Status with ID = 2 curl -X PUT --user admin@shop.de:12345 http://shop.de/api.php/v2/order_statuses/2 |
apiParamExample |
{json} Create new order status { "names": { "EN": "updated order status name", "DE": "aktualisierter order status name" }, "color": "adad1313" } |
apiParam |
{object} names Language related order status names. Provide the language id as object key. {string} color Label color of order status. |
apiSuccess |
(Success 201) Response-Body If successful, this method returns the updated order status resource in the response body. |
apiError |
400-Bad Request The API will return this status code if the order status data or order status id was not provided. |
DEFAULT_PAGE_ITEMS
var |
---|
DEFAULT_CONTROLLER_NAME
var |
---|
DEFAULT_RATE_LIMIT
var |
---|
DEFAULT_RATE_RESET_PERIOD
var |
---|