Get advert metadata

If you followed the tutorial (Receiving Advert notifications), you know that you can be notified about advert status changes through notifications sent directly to your application’s callback URL. Alternatively, we also provide endpoints where you can get the metadata (which includes the status) of a single or all adverts when needed.

❗ Temporary Solution
Get to metadata is only a temporary solution to be used during the integration phase or to get information once if you lost them for some technical reasons.

This Get should not be used as final integration. To get the status of all adverts or operation you need to have the Notification URL correctly implemented and all notifications will be sent to you and you should display them to the application user.

Get metadata of a single advert

For a single advert you can do the following:


curl --location --request GET 'https://api.olxgroup.com/advert/v1/<UUID>/meta'\
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <YOUR API KEY>' \
--header 'Authorization: Bearer <ACCESS TOKEN>' \
--header 'User-Agent: <CRM NAME>'

Here’s an example of the response:


{
    "transaction_id": "06ba5533-69b2-11e8-9341-6312550b19ed",
    "message": "Advert status information",
    "data": {
        "uuid": "f7695d17-8ee2-4409-89ac-74c673630edb",
        "last_action_status": "POSTED",
        "last_action_at": "2018-06-06T17:21:05.537+0000",
        "custom_fields": {
            "id": "123456",
            "reference_id": "TEST1234"
        },
        "state": {
            "code": "new",
            "ttl": "2018-07-04 16:01:12",
            "url": "https://www.olx.ro/d/oferta/qatest-mercury-parte-de-carro-de-ganda-mercedes-stg-urnsiteolxro-IDbi3Mq.html",
            "created_at": "2018-06-06 18:21:05",
            "activated_at": null,
            "modified_at": "2018-06-06 18:21:39",
            "moderation": {
                "reason": null,
                "description": null
            }
        },
        "last_error": null
    }
}

Get metadata of all adverts

In some cases, it might be more useful to get the status of multiple adverts in one single call. For example, when your app is displaying a page of 10 or 20 adverts, you probably don’t want to make a single API call for each one. The following endpoint returns the metadata for all adverts for a given user:


curl --location --request GET 'https://api.olxgroup.com/advert/v1/meta'\
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <YOUR API KEY>' \
--header 'Authorization: Bearer <ACCESS TOKEN>' \
--header 'User-Agent: <CRM NAME>'

Here’s an example of what you’ll get:


{
    "transaction_id": "58fda4cf-69a8-11e8-ad43-b36032d0fc62",
    "message": "Adverts status information",
    "data": [
        {
            "uuid": "81237759-90a9-468c-8c86-3ef1ca9b4b02",
            "last_action_status": "POSTED",
            "last_action_at": "2018-06-06T16:13:51.976+0000",
            "custom_fields": {
                "id": "123456",
                "reference_id": "TEST1234"
                },
            "state": {
                "code": "moderated",
                "ttl": "2018-07-04 16:01:12",
                "url": "https://www.olx.ro/d/oferta/qatest-mercury-parte-de-carro-de-ganda-mercedes-stg-urnsiteolxro-IDbi3Mq.html",
                "created_at": "2018-06-06 17:13:51",
                "activated_at": "2018-06-06 17:14:08",
                "modified_at": "2018-06-06 17:23:40",
                "moderation": {
                    "reason": "DEL_wrong_data",
                    "description": "OLX - Advert Removed - Incorrect Data"
                }
            },
            "last_error": null
        },
        {
            "uuid": "744e7fb5-60d6-4459-b41b-54c5e0eb6220",
            "last_action_status": "PUT",
            "last_action_at": "2018-06-06T16:35:41.749+0000",
            "custom_fields": {
                "id": "123456",
                "reference_id": "TEST5678"
            },
            "state": {
                "code": "active",
                "ttl": "2018-07-04T16:01:12.000+0000",
                "url": "https://www.olx.ro/d/oferta/qatest-mercury-parte-de-carro-de-ganda-mercedes-stg-urnsiteolxro-IDbi3Mq.html",
                "created_at": "2018-06-06T17:32:24.000+0000",
                "activated_at": null,
                "modified_at": "2018-06-06T17:35:41.000+0000",
                "moderation": null
            },
            "last_error": null
        }
    ],
    "links": {
        "first": {
            "href": "http://api.olxgroup.com/advert/v1/meta"
        },
        "next": {
            "href": "https://api.olxgroup.com/advert/v1/meta?exclusiveStartUuid=744e7fb5-60d6-4459-b41b-54c5e0eb6220"
        }
    }
}

Pagination

When making this request you’ll get 100 results per page. To get the next 100 results you should get the link that’s available in the links object of the response. In this object, you’ll also find a link to the first page. If there are no results at all, the links object will be omitted.