Advertisement images¶
Collection of image representations.
Currently the only way to attach an image to an advertisement is by issuing a POST against the images resource with a post body that contains a list of urls. A placeholder image will be created for each of the uploaded images. The real images are downloaded in the background and the placeholder images will be updated when downloading completes. An image will have its status attribute set to downloading until downloading completes. Clients interested in knowing when the image download has completed should poll the image resource and wait until the status attribute changes. The images will be attached to the advertisement in the order they are provided.
Each ad can contain up to 24 images. This limit is different for car dealers.
For Basic dealers the ad can contain up to 24 images, Plus dealer ads can contain up to 35 images and Premium dealer ads have a maximum of 99 images.
An image is valid if it is in JPG, PNG or BMP format and is smaller than 8MB in size. GIF images are not supported. Images will automatically be resized. It is not recommended to upload images with a size which doesn’t fit in 1024x1024 pixels box.
Note: Each url will only be downloaded once for each advertisement. Therefore if the image changes but the url stays the same then the image will not be re-downloaded. In this case you need to give the changed image a new url.
Reference¶
GET /v1/advertisements/{itemId}/images
Get all images for an advertisement
POST /v1/advertisements/{itemId}/images
Add or replace images for an advertisement
Examples¶
Getting all images for an advertisement :
Request :
GET /v1/advertisements/m1/images HTTP/1.1 Host: api.marktplaats.nlResponse :
HTTP/1.1 200 OK Content-Type: application/json { "_links":{ "self":{ "href":"/v1/advertisements/m1/images" }, "curies":[ { "name":"mp", "href":"https://api.marktplaats.nl/docs/v1/{rel}.html", "templated":true } ] }, "_embedded":{ "mp:advertisement-image":[ { "_links":{ "self":{ "href":"/v1/images/ec494827-ed10-4f43-ba15-2114f7360a8b" }, "mp:image-meta":{ "href":"/v1/images/ec494827-ed10-4f43-ba15-2114f7360a8b/{size}/meta", "templated":true }, "mp:image-blob":{ "href":"/v1/images/ec494827-ed10-4f43-ba15-2114f7360a8b/{size}/blob", "templated":true } }, "small":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/QZEREAOSwDuJWv5QR/$_14.JPG" }, "medium":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/QZEREAOSwDuJWv5QR/$_83.JPG" }, "large":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/QZEREAOSwDuJWv5QR/$_84.JPG" }, "xlarge":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/QZEREAOSwDuJWv5QR/$_85.JPG" }, "imageId":100, "mediaId":"ec494827-ed10-4f43-ba15-2114f7360a8b" }, { "_links":{ "self":{ "href":"/v1/images/7a0bc672-7af1-4b12-8c55-5347a80c8bbd" }, "mp:image-meta":{ "href":"/v1/images/7a0bc672-7af1-4b12-8c55-5347a80c8bbd/{size}/meta", "templated":true }, "mp:image-blob":{ "href":"/v1/images/7a0bc672-7af1-4b12-8c55-5347a80c8bbd/{size}/blob", "templated":true } }, "small":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_14.JPG" }, "medium":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_83.JPG" }, "large":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_84.JPG" }, "xlarge":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_85.JPG" }, "imageId":92, "mediaId": "7a0bc672-7af1-4b12-8c55-5347a80c8bbd" } ] } }
Adding an image to an advertisement :
Request :
POST /v1/advertisements/m1/images HTTP/1.1 Host: api.marktplaats.nl Content-Type: application/json { "urls": [ "http://remote.host/images/image1.jpg", "http://remote.host/images/image2.jpg" ], "replaceAll": true }Response :
HTTP/1.1 202 Accepted Content-Type: application/json { "_links":{ "self":{ "href":"/v1/advertisements/m1/images" }, "curies":[ { "name":"mp", "href":"https://api.marktplaats.nl/docs/v1/{rel}.html", "templated":true } ] }, "_embedded":{ "mp:advertisement-image":[ { "_links":{ "self":{ "href":"/v1/images/2b34c553-4a8f-4f0f-9c83-adc7badf6ac8" }, "mp:image-meta":{ "href":"/v1/images/2b34c553-4a8f-4f0f-9c83-adc7badf6ac8/{size}/meta", "templated":true }, "mp:image-blob":{ "href":"/v1/images/2b34c553-4a8f-4f0f-9c83-adc7badf6ac8/{size}/blob", "templated":true } }, "small":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/FGOPDKGlfwEgDhv4MT/$_14.JPG" }, "medium":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/FGOPDKGlfwEgDhv4MT/$_83.JPG" }, "large":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/FGOPDKGlfwEgDhv4MT/$_84.JPG" }, "xlarge":{ "href":"http://i.marktplaats.com/00/s/NTQwWDgwMA==/z/FGOPDKGlfwEgDhv4MT/$_85.JPG" }, "imageId":1, "mediaId":"2b34c553-4a8f-4f0f-9c83-adc7badf6ac8", "status": "downloading" }, { "_links":{ "self":{ "href":"/v1/images/e876adf1-deb9-4a20-909a-6814138c44e8" }, "mp:image-meta":{ "href":"/v1/images/e876adf1-deb9-4a20-909a-6814138c44e8/{size}/meta", "templated":true }, "mp:image-blob":{ "href":"/v1/images/e876adf1-deb9-4a20-909a-6814138c44e8/{size}/blob", "templated":true } }, "small":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_14.JPG" }, "medium":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_83.JPG" }, "large":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_84.JPG" }, "xlarge":{ "href":"http://i.marktplaats.com/00/s/ODAwWDQ1MA==/z/kRIAGEOSwPc9Wwb6e/$_85.JPG" }, "imageId":92, "mediaId":"e876adf1-deb9-4a20-909a-6814138c44e8", "status":"downloading" } ] } }