{"id":429,"date":"2023-12-04T11:43:25","date_gmt":"2023-12-04T11:43:25","guid":{"rendered":"https:\/\/olxdoc.wpenginepowered.com\/?p=429"},"modified":"2024-02-11T11:20:39","modified_gmt":"2024-02-11T11:20:39","slug":"create-new-images-collection","status":"publish","type":"post","link":"https:\/\/doc.olxgroup.com\/api\/?p=429","title":{"rendered":"Create new images collection"},"content":{"rendered":"\r\n<p><strong>POST<\/strong>: <a href=\"https:\/\/www.autovit.ro\/api\/open\/imageCollections\">https:\/\/www.autovit.ro\/api\/open\/imageCollections<\/a><\/p>\r\n<p><strong>Permission: <em>write<\/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<tr>\r\n<td>X-Bulk-Error<\/td>\r\n<td>string<\/td>\r\n<td>Optional header which allows you to receive errors on response body for each failed image (see examples bellow using value <em>per_item<\/em>).<br \/>The optional header allows the creation of an image collection even if all images but one fail validation. Example: 4 images fail &amp; 1 image passes validation -&gt; Image collection can still be created.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p><strong class=\"bg-tag-blue font-bold tag\">Example request:<\/strong><code>POST \/imageCollections HTTP\/1.1\r\nUser-Agent: $USER_EMAIL\r\nContent-Type: application\/json\r\nAuthorization: Bearer $ACCESS_TOKEN\r\n{\r\n    \"1\": \"http:\/\/lorempixel.com\/800\/600\/transport\/\",\r\n    \"2\": \"http:\/\/lorempixel.com\/800\/600\/transport\/\",\r\n    \"3\": \"http:\/\/lorempixel.com\/800\/600\/transport\/\"\r\n}<\/code><button>Copy<\/button> POST \/imageCollections HTTP\/1.1 User-Agent: $USER_EMAIL Content-Type: application\/json Authorization: Bearer $ACCESS_TOKEN { &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/800\/600\/transport\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/800\/600\/transport\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/800\/600\/transport\/&#8221; } Copied to clipboard<\/p>\r\n<h2><b>Success 201<\/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>id<\/td>\r\n<td>Number<\/td>\r\n<td>Images collection id<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>images<\/td>\r\n<td>Object<\/td>\r\n<td>Url&#8217;s of created images<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p>&nbsp;<\/p>\r\n<p><strong class=\"text-green font-bold\">Success response:<\/strong><code>HTTP\/1.1 201 Created\r\n{\r\n    \"id\": \"821165355\",\r\n    \"images\":\r\n    {\r\n        \"1\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/6\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/6\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/6\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/6\/\"\r\n        },\r\n        \"2\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/8\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/8\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/8\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/8\/\"\r\n        },\r\n        \"3\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/2\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/2\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/2\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/2\/\"\r\n        }\r\n    }\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 201 Created { &#8220;id&#8221;: &#8220;821165355&#8221;, &#8220;images&#8221;: { &#8220;1&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/6\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/6\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/6\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/6\/&#8221; }, &#8220;2&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/8\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/8\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/8\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/8\/&#8221; }, &#8220;3&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/2\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/2\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/2\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/2\/&#8221; } } } Copied to clipboard <strong class=\"text-green font-bold\">Success response with header X-Bulk-Error=&#8221;per_item&#8221;<\/strong><code>HTTP\/1.1 201 Created\r\n{\r\n    \"id\": \"821165355\",\r\n    \"images\":\r\n    {\r\n        \"1\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/6\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/6\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/6\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/6\/\"\r\n        },\r\n        \"2\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/8\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/8\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/8\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/8\/\"\r\n        },\r\n        \"3\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/2\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/2\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/2\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/2\/\"\r\n        }\r\n    },\r\n    \"errors\": []\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 201 Created { &#8220;id&#8221;: &#8220;821165355&#8221;, &#8220;images&#8221;: { &#8220;1&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/6\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/6\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/6\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/6\/&#8221; }, &#8220;2&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/8\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/8\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/8\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/8\/&#8221; }, &#8220;3&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/2\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/2\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/2\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/2\/&#8221; } }, &#8220;errors&#8221;: [] } Copied to clipboard <strong class=\"text-red font-bold\">Error response without header X-Bulk-Error=&#8221;per_item&#8221;<\/strong><code>HTTP\/1.1 400 Bad Request\r\n{\r\n    \"error\":\r\n    {\r\n        \"type\": \"BadRequestException\",\r\n        \"message\": \"Remote file not exists\"\r\n    }\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 400 Bad Request { &#8220;error&#8221;: { &#8220;type&#8221;: &#8220;BadRequestException&#8221;, &#8220;message&#8221;: &#8220;Remote file not exists&#8221; } } Copied to clipboard <strong class=\"text-red font-bold\">Error response with header X-Bulk-Error=&#8221;per_item&#8221; (one of the images has failed)<\/strong><code>HTTP\/1.1 201 Created\r\n{\r\n    \"id\": \"821165355\",\r\n    \"images\":\r\n    {\r\n        \"1\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/6\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/6\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/6\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/6\/\"\r\n        },\r\n        \"3\":\r\n        {\r\n            \"0\": \"http:\/\/lorempixel.com\/732\/488\/transport\/8\/\",\r\n            \"1\": \"http:\/\/lorempixel.com\/148\/110\/transport\/8\/\",\r\n            \"2\": \"http:\/\/lorempixel.com\/320\/240\/transport\/8\/\",\r\n            \"3\": \"http:\/\/lorempixel.com\/1080\/720\/transport\/8\/\"\r\n        }\r\n    },\r\n    \"errors\": {\r\n        \"2\": \"Image height must at least 100 px\"\r\n     }\r\n}<\/code><button>Copy<\/button> HTTP\/1.1 201 Created { &#8220;id&#8221;: &#8220;821165355&#8221;, &#8220;images&#8221;: { &#8220;1&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/6\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/6\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/6\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/6\/&#8221; }, &#8220;3&#8221;: { &#8220;0&#8221;: &#8220;http:\/\/lorempixel.com\/732\/488\/transport\/8\/&#8221;, &#8220;1&#8221;: &#8220;http:\/\/lorempixel.com\/148\/110\/transport\/8\/&#8221;, &#8220;2&#8221;: &#8220;http:\/\/lorempixel.com\/320\/240\/transport\/8\/&#8221;, &#8220;3&#8221;: &#8220;http:\/\/lorempixel.com\/1080\/720\/transport\/8\/&#8221; } }, &#8220;errors&#8221;: { &#8220;2&#8221;: &#8220;Image height must at least 100 px&#8221; } } Copied to clipboard<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>POST: https:\/\/www.autovit.ro\/api\/open\/imageCollections Permission: write Header Field Type Description User-Agent string Account email. X-Bulk-Error string Optional header which allows you to receive errors on response body for each failed image (see examples bellow using value per_item).The optional header allows the creation of an image collection even if all images but one fail validation. Example: 4 images&#8230;  <a href=\"https:\/\/doc.olxgroup.com\/api\/?p=429\" title=\"Read Create new images collection\">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":[11],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/429"}],"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=429"}],"version-history":[{"count":0,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=\/wp\/v2\/posts\/429\/revisions"}],"wp:attachment":[{"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.olxgroup.com\/api\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}