API를 통해 카테고리 설명이 표시되지 않음

Hi,

I’m still importing data from an old app into our new Discourse.
I can’t create a category with its description with the following API call :

curl -X POST "https://site-discourse/categories.json" \
-H "Api-Key: api-key" \
-H "Api-Username: api-username" \
-d "name=categorie test" \
-d "description=Description De La Categorie"

The category is created but there is no description.

I get the following response:

{"category":{"id":21,"name":"categorie test",[...],"slug":"categorie-test", [...] **,"description":null**,"description_text":null,"description_excerpt":null,"topic_url":"/t/a-propos-de-la-categorie-categorie-test/12286", [...]

Thanks for your help

안녕하세요 :blob_wave:

카테고리 설명은 자동으로 생성된 “About” 주제의 내용입니다. 기본 텍스트는 편집될 때까지 "null"로 간주되는 것 같습니다.

카테고리를 생성하는 요청에는 사용 가능한 “description” 매개변수가 없는 것 같으며, About 주제의 첫 번째 게시글을 업데이트하려면 별도의 API 요청을 보내야 합니다.

수입 과정에 따라 API를 사용하는 대신 적절한 가져오기 스크립트를 사용하는 것이 더 적합할 수 있습니다. #support:migration을 참고해 주세요.

Thank you for your reply

I created this script allowing you to create a category and then modify its description:

curl -X POST "https://site-discourse/categories.json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username" \
 -d "name=Catégorie 1"
 
sleep 2 
 
latest_posts_response=$(curl -X GET "https://site-discourse/posts.json" \
 -H "Content-Type: application/json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username") 
                 
post_id=$(echo $latest_posts_response | jq  '.latest_posts[0] .id')
   
curl -X PUT "https://site-discourse/posts/$post_id.json" \
 -H "Content-Type: application/json" \
 -H "Api-Key: api-key" \
 -H "Api-Username: api-username" \
 -d '{
        "post": {
        "raw": "Description de la catégorie 1"
      }
     }'

Did it work in the end?

Yes thank you it works !