Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
I am implementing Content Management API in my Optimizely solution and have successfully completed the initial setup without authentication as a starting point.
I am trying to add a block of type RichTextEditor, which has the following required property:
[Required(AllowEmptyStrings = false)]
[Display(GroupName = SystemTabNames.Content, Name = "Rich Text Content Area", Description = "Add text content area here")]
[CultureSpecific]
public virtual XhtmlString ContentArea { get; set; }
However, when attempting to create this block using the Content Management API, I receive the following error:
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Bad Request",
"status": 400,
"detail": "Error reading string. Unexpected token: StartObject. Path 'value'.",
"instance": "/api/episerver/v3.0/contentmanagement",
"code": "InvalidPropertyValue",
"traceId": "00-8bad783970639cb7e1ddc9ffa0c8ddf4-664c4166a616948e-00"
}
Here is my JSON request to create the RichTextEditor block:
"name": "Text Block (Content Management API)",
"language": {
"name": "en"
},
"contentType": [
"Block",
"RichTextEditorBlock"
],
"parentLink": {
"id": "3"
},
"contentArea": {
"value": "<p>Hello World</p>"
},
"status": "Published"
}
When I remove the ContentArea property, I am able to create the block with an empty content area successfully.
I have reviewed the documentation, but it only specifies the CRUD operations API calls:
Optimizely Content Management API Docs
So, my questions are:
1- How should I correctly pass properties of different types (e.g., XhtmlString, Url, Media, etc.) in the API request? Is there any documentation outlining how to pass various property types?
2- I have found multiple forum discussions on obtaining a token, with different URLs provided in each. One of them is shown below:
/episerverapi/token
I tried the above approach to obtain a token, but it returns the UI instead of the token. Could someone please point me in the right direction to retrieve the token before making the CRUD operation to save content in Optimizely?
It's basically I get the website UI as response when trying to get Token in Postman:
Regards.