Making API requests

Basics

Our APIs are available through HTTPS, exposing invokable operations with the common HTTP verbs with their corresponding expected behavior, i.e.:

  • GET to fetch data
  • POST to create data
  • PUT to update data
  • DELETE to delete data

Base Endpoint

The base URL of the API is https://api.olxgroup.com.

Only HTTPS requests are supported.

Also, we have available the operations DEACTIVATE and ACTIVATE through the POST operation, adding the operation to the request URL. See the example below:


curl --location --request POST 'https://api.olxgroup.com/advert/v1/<UUID>/activate'

Authentication

All requests require an API Key Header. You can find your API Key on your App Authorisation details. This key is used to identify the Application and serves as a first level Authorisation method. Additionally, some API calls might require OAuth2 Authorization Bearer or Basic Authorisation.

Check the Authorization flow to learn more about the authentication and authorization process.

Requests

Any POST or PUT requests must have its content-type set to application/json and the payload must be sent in the body of the request.

Here’s an example of a generic cURL invocation, with the payload contained in payload.json:


curl --location --request <OPERATION> 'https://<API_URL>/<API>/<VERSION>/<RESOURCE>'\
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-API-KEY: <YOUR API KEY>' \
--header 'Authorization: Bearer <ACCESS TOKEN>' \
--header "User-Agent: <YOUR CRM NAME>"
--data-raw @advert.json \

Responses

Responses, when present, are sent in JSON format (content type application/json).

Besides the response itself, the HTTP Status Code also provides relevant information. Unless otherwise stated, the following codes can be expected:

Success Status Codes

Code Name Description
200 OK For most successful operations
201 Created Successful operation that creates data
202 Accepted Request has been accepted for processing but processing hasn't completed yet
204 No Content Successful operations that do not return any content (DELETE, for example)


Error Status Codes

Code Name Description
400 Bad Request Malformed request (e.g. size too large)
401 Unauthorized The client is not authorized (e.g. missing API Key header)
403 Forbidden The client is forbidden (e.g. invalid API Key)
404 Not Found The requested resource could not be found
409 Conflict Your request conflicts with existing data (e.g. trying to update an ad that wasn't created yet)
500 Internal Server Error Server error during processing (e.g. service not available, or other abnormal conditions)