Publish Advert

Publish Advert Event Flow

Event flow name: publish_advert

This event flow contains events related to advert publishing operations. For each operation/request made, there's a success and an error event. For each event, you will find the code of the advert. These codes represent the status of the advert on the target site. See more on Advert status codes.

Further below you can see notification examples for each one of the events described.

Request: POST

Event TypeDescriptionCodeNext Available Operations
advert_posted_successAdvert was successfully created and publishedactivePUT
DELETE
DEACTIVATE
advert_posted_errorAdvert was NOT successfully created or publishedunpaid
empty code
POST

Follow examples of notifications sent for each event type described above:

advert_posted_success

{
  "destination": "*****************************",
  "timestamp": 1602838954660,
  "event_timestamp": 1602838954660,
  "transaction_id": "bdc2a547-da40-4deb-8c77-3bb174036ac5",
  "object_id": "ea17f17b-9671-4487-9043-ee9026c066a2",
  "flow": "publish_advert",
  "data": {
    "activated_at": null,
    "code": "active",
    "created_at": "2020-10-13T13:52:53.000+0000",
    "visible_in_profile": true,
    "modified_at": "2020-10-16T09:02:34.000+0000",
    "ttl": "2020-11-12T14:52:56.000+0000",
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID12aGK.html"
  },
  "event_type": "advert_posted_success"
}

advert_posted_error

This example shows the message for a posting request where mandatory urn:concept:net-area-m2 attribute was not provided. There are different messages, for example, depending on the validation errors. These validation messages come directly from the site (in this case, Imovirtual). More validation rules can be applied. Check out Advert payload and validation rules.

{
  "destination": "*****************************",
  "timestamp": 1602843883820,
  "event_timestamp": 1602843883820,
  "transaction_id": "ccaa0505-2c7c-45eb-8e68-3ba6e39f4b2f",
  "object_id": "58270dbb-c623-4ed9-9ab0-d1bd13e2a056",
  "flow": "publish_advert",
  "error_message": "Adding the ad failed.",
  "data": {
    "detail": "Adding the ad failed.",
    "title": "AdvertsPostingException",
    "validation": [
      {
        "detail": "Área útil (m²) é obrigatório",
        "field": "urn:concept:net-area-m2",
        "title": "Error"
      }
    ]
  },
  "event_type": "advert_posted_error"
}

Request: PUT

Event TypeDescriptionCodeNext Available Operations
advert_put_successAdvert was successfully updated, and remains published activePUT
DELETE
DEACTIVATE
Advert was successfully updated and remains unpublishedoutdatedPOST
ACTIVATE
DELETE
advert_put_errorAdvert was NOT successfully updated, but remains publishedactivePUT

DELETE

DEACTIVATE
Advert was NOT successfully updated, was not even createdunpaid
empty code
POST
Advert was NOT successfully updated, and remains unpublishedmoderated
removed_by_moderator
(No operation are allowed)
removed_by_userPOST or
 ACTIVATE
(depending on the last operation)

Follow examples of notifications sent for each event type described above:

advert_put_success

{
  "destination": "*****************************",
  "timestamp": 1602846166856,
  "event_timestamp": 1602846166856,
  "transaction_id": "3232cdc9-e14e-478a-88db-b9886cfd6710",
  "object_id": "ea17f17b-9671-4487-9043-ee9026c066a2",
  "flow": "publish_advert",
  "data": {
    "activated_at": null,
    "code": "active",
    "created_at": "2020-10-13T13:52:53.000+0000",
    "visible_in_profile": true,
    "modified_at": "2020-10-16T11:02:45.000+0000",
    "ttl": "2020-11-12T14:52:56.000+0000",
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14hHB.html"
  },
  "event_type": "advert_put_success"
}

advert_put_error

This example shows the message for an updating request for an advert that was not successfully created/posted. In this case, the advert in fact doesn't exist.

{
  "destination": "*****************************",
  "timestamp": 1602844812080,
  "event_timestamp": 1602844812080,
  "transaction_id": "e98edb18-6450-4b3e-a0fa-d8d89b58bdfb",
  "object_id": "58270dbb-c623-4ed9-9ab0-d1bd13e2a056",
  "flow": "publish_advert",
  "error_message": "Advert with specified external identifer 58270dbb-c623-4ed9-9ab0-d1bd13e2a056 not found for the user.",
  "data": {
    "detail": "Advert with specified external identifer 58270dbb-c623-4ed9-9ab0-d1bd13e2a056 not found for the user.",
    "title": "NotFoundException",
    "validation": null
  },
  "event_type": "advert_put_error"
}

Request: DELETE

Event TypeDescriptionCodeNext Available Operations
advert_deleted_successAdvert was successfully deleted, and was unpublishedremoved_by_user
(no longer visible in profile)
POST
advert_deleted_errorAdvert was NOT successfully deleted, and remains publishedactivePUT

DELETE

DEACTIVATE
Advert was NOT successfully deleted, was not even createdunpaid
empty code
POST
Advert was NOT successfully deleted, and remains unpublished
(these adverts were already deleted previously)
moderated
removed_by_moderated
(No operation are allowed)
removed_by_userPOST or
 ACTIVATE
(depending on the last operation)

Follow examples of notifications sent for each event type described above:

advert_deleted_success

{
  "destination": "********************************************",
  "timestamp": 1603205952227,
  "event_timestamp": 1603205952544,
  "transaction_id": "82fa2904-6ea4-4221-876e-da15079aa195",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:59:12.227+0000",
    "code": "removed_by_user",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "visible_in_profile": false,
    "modified_at": "2020-10-20T14:59:09.000+0000",
    "ttl": "2020-11-15T15:27:14.000+0000",
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_deleted_success"
}

advert_deleted_error

This example shows the message for a delete request for an advert that was previously deleted.

{
  "destination": "*********************************************",
  "timestamp": 1603205989662,
  "event_timestamp": 1603205989662,
  "transaction_id": "8747611e-13bb-4d68-8ea6-50e7a616dcb1",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "error_message": "Não é possível remover um anúncio previamente removido",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:59:12.487+0000",
    "code": "removed_by_user",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "detail": "Não é possível remover um anúncio previamente removido",
    "title": "ForbiddenException",
    "modified_at": "2020-10-20T14:59:12.000+0000",
    "ttl": "2020-10-20T14:59:12.000+0000",
    "validation": null,
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_deleted_error"
}

Request: DEACTIVATE

Event TypeDescriptionCodeNext Available Operations
advert_deactivated_successAdvert was successfully deactivated, and was unpublishedremoved_by_user
(still visible in profile)
ACTIVATE
DELETE
advert_deactivated_errorAdvert was NOT successfully deactivated, and remains publishedactivePUT

DELETE

DEACTIVATE
Advert was NOT successfully deactivated, was not even createdunpaid
empty code
POST
Advert was NOT successfully deactivated, and remains unpublished
(these adverts were already deleted previously)
moderated
removed_by_moderator
(No operation are allowed)
removed_by_userPOST or
 ACTIVATE
(depending on the last operation)

Follow examples of notifications sent for each event type described above:

advert_deactivated_success

{
  "destination": "**************************************",
  "timestamp": 1603205791027,
  "event_timestamp": 1603205791883,
  "transaction_id": "4da1b040-058b-4b55-9f7d-b3639d1cabdb",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:56:31.027+0000",
    "code": "removed_by_user",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "visible_in_profile": true,
    "modified_at": "2020-10-20T14:56:27.000+0000",
    "ttl": "2020-11-15T15:27:14.000+0000",
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_deactivated_success"
}

advert_deactivated_error

This example shows the message for a deactivation request for an advert that was already removed by a delete operation, so no longer active or even published.

{
  "destination": "**********************************",
  "timestamp": 1603205822480,
  "event_timestamp": 1603205822480,
  "transaction_id": "dede5024-c42c-4007-ba57-7cfaa0a08cfa",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "error_message": "O anúncio tem que estar ativo",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:56:31.027+0000",
    "code": "removed_by_user",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "detail": "O anúncio tem que estar ativo",
    "title": "BadRequestException",
    "modified_at": "2020-10-20T14:56:27.000+0000",
    "ttl": "2020-11-15T15:27:14.000+0000",
    "validation": null,
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_deactivated_error"
}

Request: ACTIVATE

Event TypeDescriptionCodeNext Available Operations
advert_activated_successAdvert was successfully activated, and publishedactivePUT
DELETE
DEACTIVATE
advert_activated_errorAdvert was NOT successfully activated, and remains already publishedactivePUT

DELETE

DEACTIVATE
Advert was NOT successfully activated, was not even createdunpaid
empty code
POST
Advert was NOT successfully activated, and remains unpublishedmoderated
removed_by_moderator
(No operation are allowed)
removed_by_userPOST or
 ACTIVATE
(depending on the last operation)

Follow examples of notifications sent for each event type described above:

advert_activated_success

{
  "destination": "****************************************",
  "timestamp": 1603205866623,
  "event_timestamp": 1603205867449,
  "transaction_id": "aff420de-08fe-4d6c-b5c1-798320946236",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:57:46.623+0000",
    "code": "active",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "visible_in_profile": true,
    "modified_at": "2020-10-20T14:57:43.000+0000",
    "ttl": "2020-11-15T15:27:14.000+0000",
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_activated_success"
}

advert_activated_error

This example shows the message for an activation request for an advert that was removed by a delete operation. So, no activation is possible, since the advert has definitely been removed, not temporarily as a deactivation. Activation is possible only after a Deactivation request.

{
  "destination": "**********************************************",
  "timestamp": 1603205897436,
  "event_timestamp": 1603205897436,
  "transaction_id": "3c46bab0-1fb8-4c31-8069-8a5b8bf0fc7d",
  "object_id": "866ba664-5b73-4659-b6e4-405fd6ae7c7d",
  "flow": "publish_advert",
  "error_message": "Este anúncio já se encontra ativo",
  "data": {
    "activated_at": "2020-10-20T08:28:24.000+0000",
    "recorded_at": "2020-10-20T14:57:46.623+0000",
    "code": "active",
    "moderation": {
      "reason": null,
      "description": null
    },
    "created_at": "2020-10-16T14:27:10.000+0000",
    "detail": "Este anúncio já se encontra ativo",
    "title": "BadRequestException",
    "modified_at": "2020-10-20T14:57:43.000+0000",
    "ttl": "2020-11-15T15:27:14.000+0000",
    "validation": null,
    "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID14kc5.html"
  },
  "event_type": "advert_activated_error"
}

Image Error

For POST, PUT and ACTIVATE request, the image will be added or updated to our DB, if any changes are identified on the new request. So, for each image that when an error, as a partner you will receive a notification like the one below, per image with error.

advert_image_error

The advert image was NOT successfully inserted due to non-compliance with validation rules.

{
  "destination": "https://myawesomeapp.com/webhooks",
  "timestamp": 1524148443449,
  "event_timestamp": 1531735505952,
  "transaction_id": "b5c3207c-43dc-11e8-a4a3-69e0c5b11f9f",
  "object_id": "5e606bdb-3efd-45d2-8cd5-bbb75506aaee",
  "flow": "publish_advert",
  "error_message": "width (128) is lower than the minimum of width (300) and height (128) is lower than the minimum of height (300)",
  "data": {
    "detail": "width (128) is lower than the minimum of width (300) and height (128) is lower than the minimum of height (300)",
    "title": "Dimensions not appropriate for image http://someurl.com/some-image.jpg"
  },
  "event_type": "advert_image_error"
}

Check out the most Common errors you can receive related to publishing an advert.