I've a vocabulary called Tags
. I need to create Taxonomy terms
under this vocabulary using REST service.
So What is the JSON format to create taxonomy term
. Similarly what is the JSON format to update taxonomy term
?
I'm using POSTER plugin (for Firefox) to post data.
Here are the parameters.
URL: [your path]/[end-point]/taxonomy_term.json
Content Type: application/json
Actions: POST
Here are the JSON formats.
To create Taxonomy Term
{
"vid": "1",
"name": "My First Tag",
"description": "Term description",
"vocabulary_machine_name": "tags"
}
To update Taxonomy Term
{
"tid": "14",
"vid": "1",
"name": "My First Tag Edit",
"description": "Term description changed"
}
Here tid
is taxonomy id and vid
is vocabulary id of the Taxonomy.
Hope it helps someone.
First of all tid will not be remain. It's always be incremental. You got the name, vid and description :).
You just have to use taxonomy_term_save. For more reference see this comment.