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?

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.

|improve this answer|||||
  • For anyone wandering the Interwebs you have to use PUT to update the taxonomy term. – burnsjeremy Mar 11 '15 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.

|improve this answer|||||
  • 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. – Krishna Mohan Jun 30 '14 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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