TrackingCodesApiV2Controller

Extends \HttpApiV2Controller

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

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.6.0

apiName

DeleteTrackingCode

apiGroup

TrackingCode

apiDescription

Removes an order parcel tracking code entry from the database.

apiExample

{curl} Delete Parcel Tracking Code curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/tracking_code/4

apiSuccessExample

{json} Success-Response { "code": 200, "status": "success", "action": "delete", "resource": "TrackingCode", "trackingCodeId": 4 }

apiError

400-BadRequest The provided tracking code id was invalid or not found.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code" 400, "status": "error", "message": Invalid tracking code id provided }

get

get() 
api
apiVersion

2.6.0

apiName

GetParcelTrackingCodes

apiGroup

TrackingCode

apiDescription

Returns a list with all parcel tracking code entities. You can fetch a single resource by providing the tracking code id in the request URI.

apiExample

{curl} Get all parcel tracking codes curl --user admin@shop.de:12345 http://shop.de/api.php/v2/tracking_code

{curl} Get parcel tracking code with ID = 2 curl --user admin@shop.de:12345 http://shop.de/api.php/v2/tracking_code/2

apiSuccess

Response-Body If successful, this method will return the parcel tracking code resource in JSON format.

apiSuccessExample

{json} Response-Body [ { "id": "1", "orderId": "400210", "trackingCode": "", "parcelServiceId": "0", "parcelServiceName": "Parcel Service", "languageId": "0", "url": "http://custom-url.com", "comment": "hello world", "creationDate": "2018-01-15 18:09:34" }, { "id": "2", "orderId": "400211", "trackingCode": "", "parcelServiceId": "0", "parcelServiceName": "A Parcel Service", "languageId": "0", "url": "http://best-url.com", "comment": "Custom comment", "creationDate": "2018-01-15 18:09:52" } ]

{json} Response-Body { "id": "1", "orderId": "400210", "trackingCode": "", "parcelServiceId": "0", "parcelServiceName": "Parcel Service", "languageId": "0", "url": "http://custom-url.com", "comment": "hello world", "creationDate": "2018-01-15 18:09:34" }

apiError

(Error 4xx) 404-NotFound If no resource could be found by the provided id.

getCallableResource

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

Arguments

$controller

$mappedURI

array

$api

\Slim\Slim

post

post() 
api
apiVersion

2.6.0

apiName

AddTrackingCode

apiGroup

Orders

apiDescription

Adds a new parcel tracking code to the order resource.

apiParamExample

{json} Request-Body { "parcelServiceId": 3, "trackingCode": "some-tracking-code" }

{json} Request-Body { "parcelServiceName": "My Custom Parcel Service", "url": "http://parcel-service-tracking-url.de?code=my-code" }

{json} Request-Body { "parcelServiceName": "My Custom Parcel Service", "url": "http://parcel-service-tracking-url.de?code=my-code", "comment": "This is a custom comment" }

apiParam

{int} parcelServiceId Id of parcel service, must be an existing parcel service ID.

{String} trackingCode Parcel tracking code of order.

{String} parcelServiceName Custom name of parcel service, used for lightweight entity.

{String} url Parcel tracking url of order.

{String} comment Optional comment for orders tracking code.

apiSuccess

(Success 201) Response-Body If successful, this method returns a complete TrackingCode resource in the response body.

apiError

400-BadRequest The body of the request was empty or invalid.

apiErrorExample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Tracking code 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