Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
As far as I know (and what the docs say) the SaaS CMS REST API doesn't accept binary uploads. To upload images programmatically you'll need to use CMP's upload endpoint at api.cmp.optimizely.com, Optimizely CMP Open REST API.
I am trying to upload jpg programmatically to Optimizely SaaS CMS. I am running into issues mentioned below.
I am trying via straight up REST API, trying it using postman. But I would be open to other options like using C# Optimizely Graph SDK (if that is an option).
This is what I have tried so far.
POST URL: https://api.cms.optimizely.com/preview3/experimental/content
Body JSON:
{
3. The next request is a Patch request, I update the same item id with the actual file, abc.jpg
PATCH Request URL: https://api.cms.optimizely.com/preview3/experimental/content/40531ff4780340e0a9283ce779f2f188
I attach abc.jpg to the file parameter, and set Content-Type to multipart/form-data
Here it the curl request
curl --location --request PATCH 'https://api.cms.optimizely.com/preview3/experimental/content/40531ff4780340e0a9283ce779f2f188' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer <my-bearer-token>
--form 'file=@"/C:/temp/abc.jpg"' \
--form 'Content-Type="multipart/form-data"'
This request fails with a 415 Unsupported media type error.