{"id":589,"date":"2023-12-11T13:12:00","date_gmt":"2023-12-11T13:12:00","guid":{"rendered":"https:\/\/olxdoc.wpenginepowered.com\/?p=589"},"modified":"2023-12-11T13:14:17","modified_gmt":"2023-12-11T13:14:17","slug":"publishing-adverts","status":"publish","type":"post","link":"https:\/\/doc.olxgroup.com\/api\/?p=589","title":{"rendered":"Publishing adverts"},"content":{"rendered":"\n\n\t<h1>Publishing adverts<\/h1>\n<p>How to publish adverts<\/p>\n\t<h4>Overview<\/h4>\n<p>Publishing adverts is probably the main reason you&#8217;re here for. By now you should have a registered application, know how to make requests, authorize users, advert payload, and validations that need to be in place to sends us a successful request. Let&#8217;s see\u00a0<strong>how to publish an Advert<\/strong>.<\/p>\n<h4>Basic workflow<\/h4>\n<p>To publish an advert you need the following information:<\/p>\n<ul>\n<li><strong>Advert data<\/strong>: The actual advert data (example below)<\/li>\n<li><strong>Site URN<\/strong>: The URN of the site where you are publishing the advert (<a href=\"https:\/\/developer.olxgroup.com\/docs\/supported-sites\" target=\"_self\" rel=\"noopener\">check here the available sites<\/a>)<\/li>\n<li><strong>Category URN<\/strong>: The category for your advert (check out the\u00a0<a href=\"https:\/\/developer.olxgroup.com\/docs\/taxonomies-overview\" target=\"_self\" rel=\"noopener\">Taxonomy API<\/a>)<\/li>\n<li><strong>Attribute URNs<\/strong>: Attributes make your advert more complete (also available in the\u00a0<a href=\"https:\/\/developer.olxgroup.com\/docs\/taxonomies-overview\" target=\"_self\" rel=\"noopener\">Taxonomy API<\/a>)<\/li>\n<\/ul>\n\t<h4>Publish payload example<\/h4>\n<p>You use the example below to test it out (you can also find it on our\u00a0<a href=\"https:\/\/developer.olxgroup.com\/reference\/create-advert-imovirtual\" target=\"_self\" rel=\"noopener\">API Reference<\/a>\u00a0or check\u00a0<a href=\"https:\/\/developer.olxgroup.com\/docs\/advert-validation-rules\" target=\"_self\" rel=\"noopener\">Advert validation rules<\/a>:<\/p>\n<code>JSON\n{\n  \"title\": \"[qatest-mercury] Apartamento moderno em Cabanelas\",\n  \"description\": \"Im\u00f3vel em Cabanelas com boa luminosidade, mobilado, 2 casas de banho. Este an\u00fancio \u00e9 um teste, n\u00e3o deve ser considerado.\",\n  \"category_urn\": \"urn:concept:apartments-for-sale\",\n  \"contact\": {\n    \"name\": \"Joaquim Silva\",\n    \"phone\": \"918888888\",\n    \"email\": \"joaquim.silva@testmail.com\",\n    \"photo\": \"https:\/\/i.imgur.com\/9Em2tky.png\"\n  },\n  \"price\": {\n    \"value\": 123000,\n    \"currency\": \"EUR\"\n  },\n  \"location\": {\n    \"lat\": 41.573603,\n    \"lon\": -7.214126,\n    \"exact\": true\n  },\n  \"images\": [\n    {\n      \"url\": \"https:\/\/i.imgur.com\/WozSfdQg.jpg\"\n    },\n    {\n      \"url\": \"https:\/\/i.imgur.com\/3YNg1bI.jpg\"\n    }\n  ],\n  \"movie_url\": \"https:\/\/www.youtube.com\/watch?v=2me2WO6C1J8\",\n  \"attributes\": [\n    {\n      \"urn\": \"urn:concept:area-m2\",\n      \"value\": \"110\"\n    },\n    {\n      \"urn\": \"urn:concept:price-negotiable\",\n      \"value\": \"urn:concept:yes\"\n    },\n    {\n      \"urn\": \"urn:concept:number-of-rooms\",\n      \"value\": \"urn:concept:3\"\n    },\n    {\n      \"urn\": \"urn:concept:characteristics\",\n      \"value\": \"urn:concept:alarm\"\n    },\n    {\n      \"urn\": \"urn:concept:characteristics\",\n      \"value\": \"urn:concept:central-heating\"\n    }\n  ],\n  \"site_urn\": \"urn:site:imovirtualcom\",\n  \"custom_fields\": {\n    \"id\": \"123456\",\n    \"reference_id\": \"TEST1234\"\n  }\n}<\/code><button onclick=\"copyJson('copy_17579')\">Copy<\/button>\nJSON\n{\n  &#8220;title&#8221;: &#8220;[qatest-mercury] Apartamento moderno em Cabanelas&#8221;,\n  &#8220;description&#8221;: &#8220;Im\u00f3vel em Cabanelas com boa luminosidade, mobilado, 2 casas de banho. Este an\u00fancio \u00e9 um teste, n\u00e3o deve ser considerado.&#8221;,\n  &#8220;category_urn&#8221;: &#8220;urn:concept:apartments-for-sale&#8221;,\n  &#8220;contact&#8221;: {\n    &#8220;name&#8221;: &#8220;Joaquim Silva&#8221;,\n    &#8220;phone&#8221;: &#8220;918888888&#8221;,\n    &#8220;email&#8221;: &#8220;joaquim.silva@testmail.com&#8221;,\n    &#8220;photo&#8221;: &#8220;https:\/\/i.imgur.com\/9Em2tky.png&#8221;\n  },\n  &#8220;price&#8221;: {\n    &#8220;value&#8221;: 123000,\n    &#8220;currency&#8221;: &#8220;EUR&#8221;\n  },\n  &#8220;location&#8221;: {\n    &#8220;lat&#8221;: 41.573603,\n    &#8220;lon&#8221;: -7.214126,\n    &#8220;exact&#8221;: true\n  },\n  &#8220;images&#8221;: [\n    {\n      &#8220;url&#8221;: &#8220;https:\/\/i.imgur.com\/WozSfdQg.jpg&#8221;\n    },\n    {\n      &#8220;url&#8221;: &#8220;https:\/\/i.imgur.com\/3YNg1bI.jpg&#8221;\n    }\n  ],\n  &#8220;movie_url&#8221;: &#8220;https:\/\/www.youtube.com\/watch?v=2me2WO6C1J8&#8221;,\n  &#8220;attributes&#8221;: [\n    {\n      &#8220;urn&#8221;: &#8220;urn:concept:area-m2&#8221;,\n      &#8220;value&#8221;: &#8220;110&#8221;\n    },\n    {\n      &#8220;urn&#8221;: &#8220;urn:concept:price-negotiable&#8221;,\n      &#8220;value&#8221;: &#8220;urn:concept:yes&#8221;\n    },\n    {\n      &#8220;urn&#8221;: &#8220;urn:concept:number-of-rooms&#8221;,\n      &#8220;value&#8221;: &#8220;urn:concept:3&#8221;\n    },\n    {\n      &#8220;urn&#8221;: &#8220;urn:concept:characteristics&#8221;,\n      &#8220;value&#8221;: &#8220;urn:concept:alarm&#8221;\n    },\n    {\n      &#8220;urn&#8221;: &#8220;urn:concept:characteristics&#8221;,\n      &#8220;value&#8221;: &#8220;urn:concept:central-heating&#8221;\n    }\n  ],\n  &#8220;site_urn&#8221;: &#8220;urn:site:imovirtualcom&#8221;,\n  &#8220;custom_fields&#8221;: {\n    &#8220;id&#8221;: &#8220;123456&#8221;,\n    &#8220;reference_id&#8221;: &#8220;TEST1234&#8221;\n  }\n}\nCopied to clipboard\n\t<h4>Making the API Request<\/h4>\n<p><strong>Endpoint<\/strong>: <strong>POST https:\/\/api.olxgroup.com\/advert\/v1<\/strong><\/p>\n<p>With the payload saved in <strong>advert.json<\/strong>,\u00a0the following request will publish the advert:<\/p>\n<code>cURL\ncurl --location --request POST 'https:\/\/api.olxgroup.com\/advert\/v1'\n--header 'Accept: application\/json' \n--header 'Content-Type: application\/json' \n--header 'X-API-KEY: <your API KEY>' \n--header 'Authorization: Bearer <access TOKEN>' \n--header 'User-Agent: <crm NAME>'\n--data-raw @advert.json <\/crm><\/access><\/your><\/code><button onclick=\"copyJson('copy_12761')\">Copy<\/button>\ncURL\ncurl &#8211;location &#8211;request POST &#8216;https:\/\/api.olxgroup.com\/advert\/v1&#8217;\n&#8211;header &#8216;Accept: application\/json&#8217; \n&#8211;header &#8216;Content-Type: application\/json&#8217; \n&#8211;header &#8216;X-API-KEY: <your API KEY>&#8216; \n&#8211;header &#8216;Authorization: Bearer <access TOKEN>&#8216; \n&#8211;header &#8216;User-Agent: <crm NAME>&#8216;\n&#8211;data-raw @advert.json \nCopied to clipboard\n\t<p>If all goes well, you should receive a Response with a\u00a0<strong>201<\/strong>\u00a0HTTP Status code, which looks like this:<\/p>\n<code>JSON\n{\n    \"transaction_id\": \"74c6bfc9-4163-11e8-a4a5-aff93b12a0c2\",\n    \"message\": \"Data is valid\",\n    \"data\": {\n        \"uuid\": \"b195bdbc-9074-4bac-99a1-7248c0c98892\",\n        \"last_action_status\": \"TO_POST\"\n    }\n}<\/code><button onclick=\"copyJson('copy_3706')\">Copy<\/button>\nJSON\n{\n    &#8220;transaction_id&#8221;: &#8220;74c6bfc9-4163-11e8-a4a5-aff93b12a0c2&#8221;,\n    &#8220;message&#8221;: &#8220;Data is valid&#8221;,\n    &#8220;data&#8221;: {\n        &#8220;uuid&#8221;: &#8220;b195bdbc-9074-4bac-99a1-7248c0c98892&#8221;,\n        &#8220;last_action_status&#8221;: &#8220;TO_POST&#8221;\n    }\n}\nCopied to clipboard\n\t<p>Great, you&#8217;re almost there! To check if the request was successful, prepare the Webhook\/Notification URL to handle notifications.\u00a0<a href=\"https:\/\/developer.olxgroup.com\/docs\/webhooks\" target=\"_self\" rel=\"noopener\">Learn more about webhooks here<\/a>.<\/p>\n<\/crm><\/access><\/your>\n","protected":false},"excerpt":{"rendered":"<p>Publishing adverts How to publish adverts Overview Publishing adverts is probably the main reason you&#8217;re here for. By now you should have a registered application, know how to make requests, authorize users, advert payload, and validations that need to be in place to sends us a successful request. Let&#8217;s see\u00a0how to publish an Advert. Basic&#8230;  <a href=\"https:\/\/doc.olxgroup.com\/api\/?p=589\" title=\"Read Publishing adverts\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/589"}],"collection":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=589"}],"version-history":[{"count":0,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/589\/revisions"}],"wp:attachment":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}