1

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?

2 Answers 2

1

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.

1
  • For anyone wandering the Interwebs you have to use PUT to update the taxonomy term. Commented Mar 11, 2015 at 4:23
0

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.

1
  • Sorry, may be I got you wrong. but I was not looking to create taxonomy programmatically. It was about to post JSON data to services to create/update taxonomy term. Commented Jun 30, 2014 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.