Comment trouver les IDs de tags pour ajouter des tags lors de la création d'un sujet via l'API

I wanna create topic via API

How find tags id to add tags when create topic via API

Thank!

AFAIK you don’t need tag ids. You can just pass the tag names.

3 « J'aime »

Does anyone know if this should work in 2.0.0.beta9? Tags are not mentioned in the API docs for POST /posts.
I tried to create topics with tags="testtag" but got a HTTP 500 error.

From the logs:

NoMethodError (undefined method `-' for "testtag":String)                                                                                                                                                                                       
/var/www/discourse/lib/discourse_tagging.rb:220:in `tags_for_saving' 

You should try like tags[]="testtag". It’s an array type.

3 « J'aime »

Ça ne fonctionne pas. Y a-t-il un moyen d’ajouter des balises ?

1 « J'aime »

Cela ne fonctionne pas, mon appel ressemble à ceci :

$body = '{
            "async": false,
            "title": "'.$word.'",
            "raw": "'.$definition.'",
            "category":'.$categoryId.',
            "topic_id": '.$topicsId.',
            "tags[]": "test-tag"
        }';

Cela crée le sujet, mais n’ajoute pas ou ne crée pas l’étiquette avec le nouveau sujet. @vinothkannans