Hello! I have such a problem.
When I create a category of knowledge base, everything is ok:
AUTH=$(echo -n '<my_api_key>:' | base64)
CATEGORY='{
"category": {
"content": {
"description": "Test description",
"name": "Test title",
"siteId": "primary",
"slug": "test-slug"
},
"meta": {
"position": 0
}
},
"propertyId": "<my_property_id>"
}'
curl -X 'POST' 'https://api.tawk.to/v1/knowledge-base.category.create' \
-H "Authorization: Basic $AUTH" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d "$CATEGORY"
# RESPONSE:
# {
# "ok":true,
# "data":{
# "category":{
# "id":"666bf8c0d0c0ad149089c0e0",
# "meta":{
# "sites":["primary"],
# "icon":null,
# "parent":null,
# "position":0,
# "articlesCount":0,
# "createdAt":"2024-06-14T08:01:04.382Z",
# "updatedAt":"2024-06-14T08:01:04.382Z"},
# "content":{
# "siteId":"primary",
# "name":"Test title",
# "description":"Test description",
# "slug":"test-slug",
# "createdAt":"2024-06-14T08:01:04.382Z",
# "updatedAt":"2024-06-14T08:01:04.382Z"
# }
# }
# }
# }
# }
But when I try to create an article, I get error:
ARTICLE='{
"article": {
"content": {
"title": "Test article title",
"siteId": "primary",
"slug": "test-article-slug",
"status": "published",
"contents": [
{
"type": "paragraph",
"content": {
"text": "Test paragraph"
}
}
]
},
"meta": {
"categories": [
{
"id": "666bf8c0d0c0ad149089c0e0",
"name": "Test title",
"primary": true
}
],
"visibility": "public"
}
},
"propertyId": "<my_property>"
}'
curl -X 'POST' 'https://api.tawk.to/v1/knowledge-base.article.create' \
-H "Authorization: Basic $AUTH" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d "$ARTICLE"
# RESPONSE:
# {
# "ok":false,
# "error":"validation_error",
# "message":"article.meta.categories[0].name"
# }
The category name does not contain any special characters.