Asset uploading
The asset uploading flow is split into three separate API calls:
Create a signed upload URL
For example, if you want to upload a logo
image for a property, you first need to perform an API call to sign an asset, specifying the type of asset and its MIME type. The resulting object will contain an upload URL.
curl --request POST \
--url 'https://partners.clym.io/api/portal/instance/property/sign-asset?merchant_id={yourMerchantId}' \
--header 'Authorization: Bearer {YourAPIKey}' \
--header 'Content-Type: application/json' \
--data '{
"type": "logo",
"mime": "image/png"
}'
// Result should be
{
"result": {
"url": "https://eu1.clym.io/api/u/CPKWkh3HWt7hN....."
}
}
Upload the asset
Once you've received the signed upload URL, you can now use it to upload your asset. The signed URL should look like: https://{instance}.clym.io/api/u/{uploadSignature}
The HTTP request should be a multipart/form-data
request with the asset under the asset
field name. An example can be viewed below.
curl --request POST \
--url https://eu1.clym.io/api/u/CPKWkh3HWt7hN..... \
--header 'Content-Type: multipart/form-data' \
--form asset=@/Users/clym/my-logo.png
// Result should be
{
"result": {
"id": "38f305efa9b447839...", // the asset id
"url": "...." // the URL of the asset
}
}
Use the uploaded asset id
Once you've received the asset id, you can then use it to attach it to the resource you want to use.
In the example above, we want to assign the uploaded asset to the logo
field of a property. For that, we would need to perform the following API call:
curl --request PUT \
--url 'https://partners.clym.io/api/portal/instance/property?merchant_id={yourMerchantId}' \
--header 'Authorization: Bearer {YourAPIKey}' \
--header 'Content-Type: application/json' \
--data '{ "logo": "38f305efa9b447839.." }'
Last updated