{"id":339,"date":"2023-12-04T05:17:44","date_gmt":"2023-12-04T05:17:44","guid":{"rendered":"https:\/\/olxdoc.wpenginepowered.com\/?p=339"},"modified":"2024-08-19T08:03:36","modified_gmt":"2024-08-19T08:03:36","slug":"create-new-advert-2","status":"publish","type":"post","link":"https:\/\/doc.olxgroup.com\/api\/?p=339","title":{"rendered":"Create new advert"},"content":{"rendered":"\r\n<p>This section is restricted for partners use. If You accessing API with &#8220;password&#8221; grant type &#8211; go to\u00a0Account section.<\/p>\r\n<p><strong>POST<\/strong>: <a href=\"https:\/\/www.autovit.ro\/api\/open\/adverts\">https:\/\/www.autovit.ro\/api\/open\/adverts<\/a><\/p>\r\n<p><strong>Permission: <em>\u00a0advertsWrite<\/em><\/strong><\/p>\r\n<h2>Header<\/h2>\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Field<\/th>\r\n<th>Type<\/th>\r\n<th>Description<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>User-Agent<\/td>\r\n<td>string<\/td>\r\n<td>Account email.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2><b>Query Param<\/b><\/h2>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><b>Field<\/b><\/td>\r\n<td><b>Type<\/b><\/td>\r\n<td><b>Description<\/b><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>v <b>optional<\/b><\/td>\r\n<td>Number<\/td>\r\n<td>Optional parameter to specify which version to use (2 &#8211; for new version; anything else for OLD version)<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p>&nbsp;<\/p>\r\n<h2><b>Request Body<\/b><\/h2>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><b>Field<\/b><\/td>\r\n<td><b>Type<\/b><\/td>\r\n<td><b>Description<\/b><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>coordinates<\/td>\r\n<td>Object<\/td>\r\n<td>Location for map coordinates<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>title<\/td>\r\n<td>String<\/td>\r\n<td>Title<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>description<\/td>\r\n<td>String<\/td>\r\n<td>Description<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>category_id<\/td>\r\n<td>Number<\/td>\r\n<td>Category id , see: <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Category\">Category<\/a><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>region_id<\/td>\r\n<td>Number<\/td>\r\n<td>Region id , see: <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Location-GetRegions\">Regions<\/a><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>city_id<\/td>\r\n<td>Number<\/td>\r\n<td>City id , see: <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Location-GetCities\">Cities<\/a><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>new_used<\/td>\r\n<td>String<\/td>\r\n<td>Allowed values: new, used<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>advertiser_type<\/td>\r\n<td>String<\/td>\r\n<td>Allowed values: private, business<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>email<\/td>\r\n<td>String<\/td>\r\n<td>Required for partners. Email address of the offer owner<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>partner_offer_url<\/td>\r\n<td>String<\/td>\r\n<td>Required for partners. Offer url in client service<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>external_id<\/td>\r\n<td>String<\/td>\r\n<td>Required for partners. Offer id in client database database<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>image_collection_id<\/td>\r\n<td>String<\/td>\r\n<td>Id of images collection, see: <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Images\">Images<\/a><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>district_id<\/td>\r\n<td>Number<\/td>\r\n<td>District id , see: <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Location-GetDistricts\">Districts<\/a><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 latitude<\/td>\r\n<td>Number<\/td>\r\n<td>Latitude<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 longitude<\/td>\r\n<td>Number<\/td>\r\n<td>Longitude<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 radius<\/td>\r\n<td>Number<\/td>\r\n<td>Radius<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 zoom_level<\/td>\r\n<td>Number<\/td>\r\n<td>Zoom level<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>contact<\/td>\r\n<td>Object<\/td>\r\n<td>Contact object<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 phones<\/td>\r\n<td>Array<\/td>\r\n<td>The list of phones to contact<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u00a0 person<\/td>\r\n<td>Object<\/td>\r\n<td>The name of the person to contact<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>params<\/td>\r\n<td>Object<\/td>\r\n<td>Detailed advert parameters, see <a href=\"https:\/\/www.otomoto.pl\/api\/doc\/?api-docs&amp;utm_source=motopedia&amp;utm_medium=article-jak-uzyskac-dostep-do-api&amp;_gl=1*4d3qtg*_ga*MTUwNTYyMDk1OS4xNzAwODI3MTQ1*_ga_1MNBX75RRH*MTcwMjM4MDg1MC4xLjAuMTcwMjM4MDg1MC4wLjAuMA..#api-Category\">Category<\/a> to find what parameters are available for specific category<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p>&nbsp;<\/p>\r\n<p><strong class=\"bg-tag-blue font-bold tag\">Example request:<\/strong><code>POST \/adverts HTTP\/1.1\r\nUser-Agent: $USER_EMAIL\r\nContent-Type: application\/json\r\nAuthorization: Bearer $ACCESS_TOKEN\r\n{\r\n    \"title\": \"Advert title\",\r\n    \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\",\r\n    \"category_id\": 29,\r\n    \"region_id\": 1,\r\n    \"city_id\": 1,\r\n    \"district_id\": 1,\r\n    \"coordinates\":\r\n    {\r\n        \"latitude\": 52.39255,\r\n        \"longitude\": 16.86718\r\n    },\r\n    \"contact\":\r\n    {\r\n        \"person\": \"John Doe\"\r\n    },\r\n    \"params\":\r\n    {\r\n        \"vin\": \"11111111111111111\",\r\n        \"year\": 2018,\r\n        \"make\": \"ford\",\r\n        \"model\": \"focus\",\r\n        \"fuel_type\": \"petrol\",\r\n        \"engine_power\": \"86\",\r\n        \"engine_capacity\": \"1596\",\r\n        \"door_count\": 4,\r\n        \"gearbox\": \"manual\",\r\n        \"generation\": \"gen-mk4-2018\",\r\n        \"version\": \"ver-1-6-gold-x\",\r\n        \"mileage\": 199000,\r\n        \"body_type\": \"sedan\",\r\n        \"color\": \"white\",\r\n        \"price\":\r\n        {\r\n            \"0\": \"price\",\r\n            \"1\": 2000,\r\n            \"currency\": \"PLN\",\r\n            \"gross_net\": \"gross\"\r\n        },\r\n        \"video\": \"https:\/\/www.youtube.com\/watch?v=code\"\r\n    }\r\n    \"image_collection_id\": 821165355,\r\n    \"external_id\": \"126\",\r\n    \"partner_offer_url\": \"http:\/\/partner-domain\/partner-offer-url\",\r\n    \"advertiser_type\": \"private\",\r\n    \"new_used\" : \"used\"\r\n}<\/code><button>Copy<\/button> POST \/adverts HTTP\/1.1 User-Agent: $USER_EMAIL Content-Type: application\/json Authorization: Bearer $ACCESS_TOKEN { &#8220;title&#8221;: &#8220;Advert title&#8221;, &#8220;description&#8221;: &#8220;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&#8221;, &#8220;category_id&#8221;: 29, &#8220;region_id&#8221;: 1, &#8220;city_id&#8221;: 1, &#8220;district_id&#8221;: 1, &#8220;coordinates&#8221;: { &#8220;latitude&#8221;: 52.39255, &#8220;longitude&#8221;: 16.86718 }, &#8220;contact&#8221;: { &#8220;person&#8221;: &#8220;John Doe&#8221; }, &#8220;params&#8221;: { &#8220;vin&#8221;: &#8220;11111111111111111&#8221;, &#8220;year&#8221;: 2018, &#8220;make&#8221;: &#8220;ford&#8221;, &#8220;model&#8221;: &#8220;focus&#8221;, &#8220;fuel_type&#8221;: &#8220;petrol&#8221;, &#8220;engine_power&#8221;: &#8220;86&#8221;, &#8220;engine_capacity&#8221;: &#8220;1596&#8221;, &#8220;door_count&#8221;: 4, &#8220;gearbox&#8221;: &#8220;manual&#8221;, &#8220;generation&#8221;: &#8220;gen-mk4-2018&#8221;, &#8220;version&#8221;: &#8220;ver-1-6-gold-x&#8221;, &#8220;mileage&#8221;: 199000, &#8220;body_type&#8221;: &#8220;sedan&#8221;, &#8220;color&#8221;: &#8220;white&#8221;, &#8220;price&#8221;: { &#8220;0&#8221;: &#8220;price&#8221;, &#8220;1&#8221;: 2000, &#8220;currency&#8221;: &#8220;PLN&#8221;, &#8220;gross_net&#8221;: &#8220;gross&#8221; }, &#8220;video&#8221;: &#8220;https:\/\/www.youtube.com\/watch?v=code&#8221; } &#8220;image_collection_id&#8221;: 821165355, &#8220;external_id&#8221;: &#8220;126&#8221;, &#8220;partner_offer_url&#8221;: &#8220;http:\/\/partner-domain\/partner-offer-url&#8221;, &#8220;advertiser_type&#8221;: &#8220;private&#8221;, &#8220;new_used&#8221; : &#8220;used&#8221; } Copied to clipboard <strong class=\"text-green font-bold\">Success response:<\/strong><code>HTTP\/1.1 201 Created\r\n{\r\n    \"id\": 999,\r\n    \"user_id\": 1,\r\n    \"status\": \"active\",\r\n    \"title\": \"Advert title\",\r\n    \"url\": \"http:\/\/{example.com}\/ad\/{example}.html\",\r\n    \"created_at\": \"2015-10-01 10:54:11\",\r\n    \"valid_to\": \"2015-10-15 11:05:34\",\r\n    \"description\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\",\r\n    \"category_id\": 29,\r\n    \"region_id\": 3,\r\n    \"city_id\": 24545,\r\n    \"municipality\": \"Municipality name\",\r\n    \"city\":\r\n    {\r\n        \"pl\": \"City name\",\r\n        \"en\": \"City name\"\r\n    },\r\n    \"coordinates\":\r\n    {\r\n        \"latitude\": 51.26247,\r\n        \"longitude\": 15.56956,\r\n        \"radius\": 4,\r\n        \"zoom_level\": 12\r\n    },\r\n    \"advertiser_type\": \"private\",\r\n    \"contact\":\r\n    {\r\n        \"person\": \"John Doe\"\r\n    },\r\n    \"params\":\r\n    {\r\n        \"vin\": \"11111111111111111\",\r\n        \"year\": 2018,\r\n        \"make\": \"ford\",\r\n        \"model\": \"focus\",\r\n        \"fuel_type\": \"petrol\",\r\n        \"engine_power\": \"86\",\r\n        \"engine_capacity\": \"1596\",\r\n        \"door_count\": 4,\r\n        \"gearbox\": \"manual\",\r\n        \"generation\": \"gen-mk4-2018\",\r\n        \"version\": \"ver-1-6-gold-x\",\r\n        \"mileage\": 199000,\r\n        \"body_type\": \"sedan\",\r\n        \"color\": \"white\",\r\n        \"price\":\r\n        {\r\n            \"0\": \"price\",\r\n            \"1\": 2000,\r\n            \"currency\": \"PLN\",\r\n            \"gross_net\": \"gross\"\r\n        },\r\n        \"video\": \"https:\/\/www.youtube.com\/watch?v=code\"\r\n    },\r\n    \"external_partner_code\": \"partner-code\",\r\n    \"external_id\": \"126\",\r\n    \"last_update_date\": \"2015-10-15 11:05:35\",\r\n    \"new_used\": \"used\"\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 201 Created { &#8220;id&#8221;: 999, &#8220;user_id&#8221;: 1, &#8220;status&#8221;: &#8220;active&#8221;, &#8220;title&#8221;: &#8220;Advert title&#8221;, &#8220;url&#8221;: &#8220;http:\/\/{example.com}\/ad\/{example}.html&#8221;, &#8220;created_at&#8221;: &#8220;2015-10-01 10:54:11&#8221;, &#8220;valid_to&#8221;: &#8220;2015-10-15 11:05:34&#8221;, &#8220;description&#8221;: &#8220;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&#8221;, &#8220;category_id&#8221;: 29, &#8220;region_id&#8221;: 3, &#8220;city_id&#8221;: 24545, &#8220;municipality&#8221;: &#8220;Municipality name&#8221;, &#8220;city&#8221;: { &#8220;pl&#8221;: &#8220;City name&#8221;, &#8220;en&#8221;: &#8220;City name&#8221; }, &#8220;coordinates&#8221;: { &#8220;latitude&#8221;: 51.26247, &#8220;longitude&#8221;: 15.56956, &#8220;radius&#8221;: 4, &#8220;zoom_level&#8221;: 12 }, &#8220;advertiser_type&#8221;: &#8220;private&#8221;, &#8220;contact&#8221;: { &#8220;person&#8221;: &#8220;John Doe&#8221; }, &#8220;params&#8221;: { &#8220;vin&#8221;: &#8220;11111111111111111&#8221;, &#8220;year&#8221;: 2018, &#8220;make&#8221;: &#8220;ford&#8221;, &#8220;model&#8221;: &#8220;focus&#8221;, &#8220;fuel_type&#8221;: &#8220;petrol&#8221;, &#8220;engine_power&#8221;: &#8220;86&#8221;, &#8220;engine_capacity&#8221;: &#8220;1596&#8221;, &#8220;door_count&#8221;: 4, &#8220;gearbox&#8221;: &#8220;manual&#8221;, &#8220;generation&#8221;: &#8220;gen-mk4-2018&#8221;, &#8220;version&#8221;: &#8220;ver-1-6-gold-x&#8221;, &#8220;mileage&#8221;: 199000, &#8220;body_type&#8221;: &#8220;sedan&#8221;, &#8220;color&#8221;: &#8220;white&#8221;, &#8220;price&#8221;: { &#8220;0&#8221;: &#8220;price&#8221;, &#8220;1&#8221;: 2000, &#8220;currency&#8221;: &#8220;PLN&#8221;, &#8220;gross_net&#8221;: &#8220;gross&#8221; }, &#8220;video&#8221;: &#8220;https:\/\/www.youtube.com\/watch?v=code&#8221; }, &#8220;external_partner_code&#8221;: &#8220;partner-code&#8221;, &#8220;external_id&#8221;: &#8220;126&#8221;, &#8220;last_update_date&#8221;: &#8220;2015-10-15 11:05:35&#8221;, &#8220;new_used&#8221;: &#8220;used&#8221; } Copied to clipboard <strong class=\"text-red font-bold\">Error response example:<\/strong><code>HTTP\/1.1 400 Bad Request\r\n{\r\n    \"error\":\r\n    {\r\n        \"type\": \"AdvertsPostingException\",\r\n        \"message\": \"Adding the ad failed.\",\r\n        \"details\":\r\n        {\r\n            \"district\": \"Choose a district from city\",\r\n            \"params.price\": \"You should specify a price\"\r\n        }\r\n    }\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 400 Bad Request { &#8220;error&#8221;: { &#8220;type&#8221;: &#8220;AdvertsPostingException&#8221;, &#8220;message&#8221;: &#8220;Adding the ad failed.&#8221;, &#8220;details&#8221;: { &#8220;district&#8221;: &#8220;Choose a district from city&#8221;, &#8220;params.price&#8221;: &#8220;You should specify a price&#8221; } } } Copied to clipboard<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>This section is restricted for partners use. If You accessing API with &#8220;password&#8221; grant type &#8211; go to\u00a0Account section. POST: https:\/\/www.autovit.ro\/api\/open\/adverts Permission: \u00a0advertsWrite Header Field Type Description User-Agent string Account email. Query Param Field Type Description v optional Number Optional parameter to specify which version to use (2 &#8211; for new version; anything else for&#8230;  <a href=\"https:\/\/doc.olxgroup.com\/api\/?p=339\" title=\"Read Create new advert\">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":[8],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/339"}],"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=339"}],"version-history":[{"count":0,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/339\/revisions"}],"wp:attachment":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}