Skip to main content

API Requests

API URL

The URL of Aplazame’s API service is available at https://api.aplazame.com.

HTTP Headers

GET /orders HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
ParameterTypeRequiredDescription
AcceptstringYesSpecifies the Aplazame API version and the datatype expected.
AuthorizationstringYesType and access key.

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1

OAuth2 is an open standard for authorisation defined in RFC 6749.

OAuth2 is easier to work with than OAuth1 and provides much better security.

Versioning

The Accept header is used to indicate the API version, expected content type (and sandbox mode).

GET /orders HTTP/1.1
Accept: application/vnd.aplazame.v1+(json|xml)
Authorization: Bearer api_private_key
Host: api.aplazame.com

Although versioning via URL is currently allowed (e.g. https://api.aplazame.com/v1/orders), it is better practice to use the Accept header in the request to specify the type and format of the API service response.

If the API version is not indicated in the header or via URL, the latest version of the API will be activated. Since a new version of the API can deprecate certain fields, it is recommended you always specify the API version

Format types allowed

HeaderVersionExpected formatValue
Accept1jsonapplication/vnd.aplazame.v1+json
Accept1xmlapplication/vnd.aplazame.v1+xml

Decimals

tip

All amounts related to taxes, discounts and prices will be formatted as an integer including two decimal places (i.e. amounts in cents). For example, if an item has a price of €12.50 should be formatted as an integer 1250.

$ if ((`bc <<< "12.50!=1250"`)); then echo "beep beeeeeeep!!!"; fi

Errors

HTTP/1.1 400 BAD REQUEST
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1
{
"error": {
"fields": {
"articles": [
"This field is required."
]
},
"message": "API validation error",
"type": "ApiValidationException"
}
}

List of error codes returned by the API.

CodeErrorMeaning
400Bad RequestIf the data have not been correctly validated.
401UnauthorizedIf the token (public/private key) is not sent in the request or is wrong.
403ForbiddenIf you do not have permission to do this operation.
404Not FoundIf the object or the resource is not found.
405Method Not AllowedYou tried to access with an invalid method (GET/POST/...).
406Not AcceptableThe Accept header is invalid see headers.
408Request timeoutThe server timed out waiting for the request.
409ConflictIndicates that the request could not be processed because of a conflict in the request.
415Unsupported Media TypeThere is no support for the content type indicated in the Content-Type header.
429Too Many RequestsIf multiple simultaneous requests are made.
500Internal Server ErrorError in the API server. This may be caused by an implementation error, a temporary network issue, etc. Please try again later.
503Service UnavailableTemporarily offline for maintenance. Please try again later.

Pagination

GET /orders?page=2 HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Aplazame-Media-Type: aplazame.v1
{
"cursor": {
"after": 3,
"before": 1
},
"paging": {
"count": 314,
"next": "https://api.aplazame.com/orders?page=3",
"previous": "https://api.aplazame.com/orders?page=1"
},
"results": []
}
ParameterTypeDescription
cursorobjectPagination cursor object
pagingobjectPagination status
resultscollectionList of stores

cursor

"cursor": {
"after": 3,
"before": 1
}
ParameterTypeDescription
afterintegerIndex of the previous page.
beforeintegerIndex of the next page.

paging

"paging": {
"count": 314,
"next": "https://api.aplazame.com/orders?page=3",
"previous": "https://api.aplazame.com/orders?page=1"
}
ParameterTypeDescription
countintegerNumber of items found.
nextURLAPI URL (endpoint) to the next page of results.
previousURLAPI URL (endpoint) to the previous page of data.

Filters

The filters of the list queries are indicated in the URL parameters. The parameter format is comprised of the entity, lookup type and value.

GET /orders?propiedad-busqueda=valor

In the following example, the request will return all orders whose id starts with 'e791f'. If the match type is omitted, exact will be used.

GET /orders?id-startswith=e791f HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com

If various filters are specified, the result will return a combination of all of them.

GET /orders?id-startswith=e791f&id-endswith=4ff4g HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
TermUsageDescription
exactname-exact=AplaZameExact match.
iexactname-iexact=aplazameCase-insensitive* exact match.
regexname-regex=^[A-Z].*$Case-sensitive regular expression.
iregexname-iregex=^[a-z].*$Case-insensitive regular expression.
containsname-contains=plaZaString containing a case-insensitive value.
icontainsname-icontains=plazaString containing a case-sensitive value.
startswithname-startswith=AplaString starts with specified value.
istartswithname-istartswith=aplaString starting with case-insensitive value.
endswithname-endswith=ZameString ending with value.
iendswithname-iendswith=zameString ending with case-insensitive value.
inname-in=AplaZame,AplazarMatches any of the comma-separated values.
searchname-search=ApString search value.

By date

GET /orders?confirmed-week_day=monday HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
TermUsageDescription
yearcreated-year=2015Dates whose year matches the value entered.
monthcreated-month=10Dates whose month matches the value entered.
week_daycreated-week_day=mondayDay of the week; the choices are: monday, tuesday, wednesday, thursday, friday, saturday, sunday.
daycreated-day=2Dates whose day matches the value entered.
hourcreated-hour=14Dates whose time matches the value entered.

Nulo

TermUsageDescription
isnullconfirmed-isnull=yesFilter by null fields, yes OR no

Value ranges

GET /orders?confirmed-gte=2015-10-02T18:15:45.101838Z HTTP/1.1
Accept: application/vnd.aplazame.v1+json
Authorization: Bearer api_private_key
Host: api.aplazame.com
TermUsageDescription
exacttotal_amount-exact=10000Exact value.
gttotal_amount-gt=8000Greater than.
gtetotal_amount-gte=10000Greater than or equal to.
lttotal_amount-lt=12000Less than.
ltetotal_amount-lte=10000Less than or equal to.