Profile image¶
Image used as the user’s profile picture.
There are two ways to set/update the profile image. One way is by issuing a POST against the profile-image resource with a post body that contains a URL. A placeholder image will be created for the uploaded image and the real image is downloaded in the background. 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 profile-image resource and wait until the status attribute changes.
Another way to update the profile image is to issue a multipart/form-data POST against the profile-image resource with a post body that contains the image.
See image to find out which fields are returned when issuing a GET against this resource.
Reference¶
GET /v1/users/{userId}/profile/profile-image
Returns the profile. Returns statuscode 404 if no backdrop image is available.
POST /v1/users/{userId}/profile/profile-image
Set the profile image of a user profile.
DELETE /v1/users/{userId}/profile/profile-image
Remove the profile image.
Errors¶
http | error code | description |
---|---|---|
400 | validation-failure | Validation of the image failed
There should be more information in the field errors
|
Field errors¶
field | error code | error value | description |
---|---|---|---|
<field name> | field-missing | The value for this field is missing. | |
file | file-too-large | The file supplied to this field exceeds the allowed size. | |
file | invalid-file-format | The file supplied isn’t one of the allowed file types (or is empty). |
Examples¶
Retrieving an image :
Request :
GET /v1/users/1/profile/profile-image HTTP/1.1 Host: api.marktplaats.nlResponse :
HTTP/1.1 200 OK Content-Type: application/json { "_links": { "self": { "href": "/v1/images/7a0bc672-7af1-4b12-8c55-5347a80c8bbd" }, "curies": [ { "name": "mp", "href": "https://api.marktplaats.nl/docs/v1/{rel}.html", "templated": true } ], "mp:image-meta": { "href": "/v1/images/1/{size}/meta", "templated": true }, "mp:image-blob": { "href": "/v1/images/1/{size}/blob", "templated": true } }, "imageId": 1, "mediaId": "7a0bc672-7af1-4b12-8c55-5347a80c8bbd", "status": "downloading", "small": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "medium": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "large": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_83.JPG" }, "xlarge": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_84.JPG" } }
Setting the profile picture of a user:
Request :
POST /v1/users/1/profile/profile-image HTTP/1.1 Host: api.marktplaats.nl Content-Type: application/json { "url": "http://remote.host/images/image1.jpg" }Response :
HTTP/1.1 202 Accepted Content-Type: application/json { "_links": { "self": { "href": "/v1/images/2b34c553-4a8f-4f0f-9c83-adc7badf6ac8" }, "curies": [ { "name": "mp", "href": "https://api.marktplaats.nl/docs/v1/{rel}.html", "templated": true } ], "mp:image-meta": { "href": "/v1/images/1/{size}/meta", "templated": true }, "mp:image-blob": { "href": "/v1/images/1/{size}/blob", "templated": true } }, "imageId": 1, "mediaId": "2b34c553-4a8f-4f0f-9c83-adc7badf6ac8", "status": "downloading", "small": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "medium": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "large": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_83.JPG" }, "xlarge": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_84.JPG" } }
Deleting the profile image :
Request :
DELETE /v1/users/1/profile/profile-image HTTP/1.1 Host: api.marktplaats.nlResponse :
HTTP/1.1 200 OK
Example of setting the profile picture of a user with a multipart POST:
Request :
POST /v1/users/1/profile/profile-image HTTP/1.1 Host: api.marktplaats.nl Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryR72TbPDfrqjNFgQi Request Payload: ------WebKitFormBoundaryR72TbPDfrqjNFgQi Content-Disposition: form-data; name="file"; filename="funny-monkey-1.jpg" Content-Type: image/jpeg ------WebKitFormBoundaryR72TbPDfrqjNFgQi--Response :
HTTP/1.1 202 Accepted Content-Type: application/json { "_links": { "self": { "href": "/v1/images/8e9341df-09ca-416a-96cd-8e861fc108dc" }, "curies": [ { "name": "mp", "href": "https://api.marktplaats.nl/docs/v1/{rel}.html", "templated": true } ], "mp:image-meta": { "href": "/v1/images/1/{size}/meta", "templated": true }, "mp:image-blob": { "href": "/v1/images/1/{size}/blob", "templated": true } }, "imageId": 1, "mediaId": "8e9341df-09ca-416a-96cd-8e861fc108dc", "status": "available", "small": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "medium": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_82.JPG" }, "large": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_83.JPG" }, "xlarge": { "href": "https://eps.marktplaats.test/eps/8780296fd30d43c354ae83216f325610/$_84.JPG" } }