Score:1

Create vocabularies with the JSON API

es flag

I found this identical question but it seems to be dead and none of the answers help me. I also don't have enough reputation to ask in a comment, so, since I'm at the end of my rope with this issue, I'm posting my own question.

I'll preface the issue with what I've done as I have put effort into solving this on my own:

I have the additional operations enabled:

I have the additional operations enabled

I'm using the path /jsonapi/taxonomy_vocabulary/taxonomy_vocabulary.

I'm sending the following request body:

{
  "data": [
    {
      "type": "taxonomy_vocabulary--taxonomy_vocabulary",
      "id": "d0a3157e-58ad-7a43-93ff-a9b76f2273b6",
      "attributes": {
        "name": "Listing Categories",
        "drupal_internal__vid": "listing_categories"
      }
    }
  ]
}

And I get the following response:

{
  "jsonapi": {...},
  "errors": [
    {
      "title": "Method Not Allowed",
      "status": "405",
      "detail": "No route found for \"POST /jsonapi/taxonomy_vocabulary/taxonomy_vocabulary\": Method Not Allowed (Allow: GET, HEAD)",
      "links": {...},
      "source": {...},
      "meta": {...}
    }
  ]
}

I'm having no issues creating nodes, terms, or even paragraphs with POST requests, so I'm at a complete loss as to why POST requests to create vocabularies are being denied. I've tried searching various terms to see if this is a known bug with vocabularies, but I haven't been able to find anything, which leads me to suspect that I'm missing something on my end. Thanks in advance

Lastly, I apologize for the tags. I'm not used to asking on stack exchange, so I might be missing something obvious, but I can't seem to actually add relevant tags such as jsonapi, json, rest, taxonomy, or vocabulary. The only thing close I can add is taxonomy-terms.

Score:1
ph flag

Vocabularies are config entities, and config entities don't currently allow post operations.

See this issue:

https://www.drupal.org/node/2300677

JBHUTT09 avatar
es flag
Ah, that would do it. Thanks. I didn't know the term "config entity" so I never searched for that.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.