VpeApiV2Controller

Extends \HttpApiV2Controller

Class VpeApiV2Controller

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.

category

System

package

ApiV2Controllers

Methods

AbstractApiV2Controller Constructor

__construct(\Slim\Slim $api, array $uri) 
inherited

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
\HttpApiV2Exception

Through _validateRequest

Arguments

$api

\Slim\Slim

Slim framework instance, used for request/response manipulation.

$uri

array

This array contains all the segments of the current request, starting from the resource.

delete

delete() 
api
apiVersion

2.5.0

apiName

DeleteVPE

apiGroup

VPE

apiDescription

Removes a vpe record from the system. This method will always return success even if the vpe does not exist (due to internal VPEWriteService architecture decisions, which strive to avoid unnecessary failures).

apiExample

{curl} Delete VPE with ID = 84 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/vpe/84

apiSuccessExample

{json} Success-Response { "code": 200, "status": "success", "action": "delete", "vpeId": 84 }

get

get() 
api
apiVersion

2.5.0

apiName

GetVPE

apiGroup

VPE

apiDescription

Get multiple or a single vpe record through the GET method

apiExample

{curl} Get All VPE records curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/vpe

{curl} Get VPE record With ID = 982 curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/vpe/982

apiError

404-NotFound VPE record could not be found.

apiErrorExample

Error-Response (VPE Not Found) HTTP/1.1 404 Not Found { "code": 404, "status": "error", "message": "Vpe record could not be found." }

getCallableResource

getCallableResource( $controller, array $mappedURI, \Slim\Slim $api) 
inherited static

Arguments

$controller

$mappedURI

array

$api

\Slim\Slim

patch

patch() 
api
apiVersion

2.5.0

apiName

UpdateVPE

apiGroup

VPE

apiDescription

Use this method if you want to update an existing vpe record.

apiParamExample

{json} VPE entity { "name": { "EN": "API Packing unit", "DE": "API Verpackungseinheit" } }

apiParam

{Object} name Object that contains the language codes as key and the vpe name as value.

apiSuccess

(200) Request-Body If successful, this method returns the complete vpe resource in the response body.

apiSuccessExample

{json} Success-Response { "id": 4, "name": { "EN": "API Packing unit", "DE": "API Verpackungseinheit" } }

apiError

400-BadRequest VPE data were not provided or vpe 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": "VPE data were not provided." }

Error-Response (Missing or invalid ID) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "VPE record ID was not provided or is invalid." }

post

post() 
api
apiVersion

2.5.0

apiName

CreateVPE

apiGroup

VPE

apiDescription

This method enables the creation of a new VPE into the system.

apiParamExample

{json} Request-Body { "name": { "EN": "API Packing unit", "DE": "API Verpackungseinheit" } }

apiParam

{Object} name Object that contains the language codes as key and the vpe name as value.

apiSuccess

(201) Request-Body If successful, this method returns the complete vpe resource in the response body.

apiError

400-BadRequest The body of the request was empty.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "VPE data were not provided." }

Constants

Defines the default page offset for responses that return multiple items.

DEFAULT_PAGE_ITEMS
inherited
var

Default controller to be loaded when no resource was selected.

DEFAULT_CONTROLLER_NAME
inherited
var

Defines the maximum request limit for an authorized client.

DEFAULT_RATE_LIMIT
inherited
var

Defines the duration of an API session in minutes.

DEFAULT_RATE_RESET_PERIOD
inherited
var

Properties