Content Formating

General information on request headers, content type and status codes relating to the Yordadev's headless e-Commerce API.

Header Information

All requests, unless otherwise stated require an Authorization Token and in some cases require a X-Customer-Token header as well. Below is an example demonstrating a curl POST request using multiple authorization tokens.

curl --location --request POST 'https://yorshop.yordadev.network/v1/cart/' \
--header 'Authorization: Bearer <Shop Client Credential Token>' \
--header 'X-Customer-Token: Bearer <Customer or Guest Access Token>' \

Keep your access token's safe, only shop Implicit access tokens should be utilized on the client side when consuming Yordadev resources.

Content Type

Requests made to the OAuth Service while in regards to authentication, requests must contain the header:

--header 'Content-Type: application/x-www-form-urlencoded' \

In all other instances, requests to the API must be encoded as JSON and include the header:

--header 'Content-Type: application/json' \

Response Information

All responses returned from Yordadev's headless e-Commerce API are encoded as JSON. A normal response will consist of 3 elements:

{
"status": <XXX>,
"payload": {
// expected data to be returned
// here
},
"meta": {
"from": "",
"agent": "",
"origin": ""
}
}

As shown in the above example, every response will contain this basic information.

Typical Status Codes

200 Code

This is returned when a request is successful but no content is created or updated.

201 Code

This is returned when a request is successful when creating or updating content.

Error Status Codes

When an error is encountered, it will be returned in the same 3 elements of the response and will contain information regarding the error within the payload.

400 Code

This is returned when a bad request is received.

401 Code

This is returned when a request is not authorized.

404 Code

This is returned when a request failed validation services.

427 Code

This is returned when a request has been rate limited.

500 Series

If this is returned, something broke and please send feedback to [email protected]