Image upload
How can we upload images using the API?
We have a token system in place to upload the images. The first step is to upload all the images using the below upload endpoint. The format of the file needs to be binary, and needs to be sent in the key 'file'.
see File Upload
Here an exemple of a curl request :
$ curl 'https://api-upload.mycrm.com/upload?type=property_image' \
-H 'authorization: Bearer{Token} \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryOeqt8OBtDAl8KiQr' \
--data-raw $'------WebKitFormBoundaryOeqt8OBtDAl8KiQr\r\nContent-Disposition: form-data; name="file"; filename="myfile.png"\r\nContent-Type: image/png\r\n\r\n\r\n------WebKitFormBoundaryOeqt8OBtDAl8KiQr--\r\n' \
--compressed
Using this endpoint will result in the following response:
{
"upload": {
"created_at": "2023-06-26T06:25:35.578913947Z",
"token": "429aef06-13ea-11ee-96fe-de4271e1b760",
"type": "property_image",
"link": "https://{original_image_url}",
"thumbnails": [
{
"width": 0,
"height": 0,
"link": "https://{original_image_watermarked_url}",
"format": "full"
},
{
"width": 80,
"height": 80,
"link": "https://{thumbnail_image_watermarked_url}",
"format": "thumb"
},
{
"width": 540,
"height": 540,
"link": "https://{medium_image_watermarked_url}",
"format": "medium"
}
]
}
}
During the upload, the api is generating three formats for the image :
• thumb
• full
• medium
All those three formats will be watermarked if you specified a watermark in your client settings. You can upload the watermark for the images from the PF expert platform as shown below :
$ curl 'https://api-upload.mycrm.com/upload?type=client_watermark' \
-H 'authorization: Bearer{Token} \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryOeqt8OBtDAl8KiQr' \
--data-raw $'------WebKitFormBoundaryOeqt8OBtDAl8KiQr\r\nContent-Disposition: form-data; name="file"; filename="myfile.png"\r\nContent-Type: image/png\r\n\r\n\r\n------WebKitFormBoundaryOeqt8OBtDAl8KiQr--\r\n' \
--compressed
Each time you upload, attach the tokens to the appropriate property as shown below:
{
"property": {
...
"images": [
{
"image": {
"id": 103338940,
"order": 1
}
},
{
"image": {
"id": 103338941,
"order": 2
}
},
{
"image": {
"order": 3,
"token": "a7d0f2bb-13eb-11ee-96fe-de4271e1b760"
}
}
]
}
}
Each token you submit will receive an image id when you save the property.
If you require further information or assistance, please reach out to our Customer Support team by email support@propertyfinder.ae or by calling 800-PFINDER