I have a test script to create (POST) a term for a Tags vocabulary using cUrl. That simple script is working fine on Drupal 8.9.20, but it returns a 404 error on Drupal 9.3.0.
{"message":"No route found for 'POST \/entity\/taxonomy\/term\/taxonomy_term'"}
What is the POST end point for taxonomy terms?
I tried with different endpoints, but I get the same error message. In Drupal 8, they work.
In Drupal 9, I'm able to POST for nodes; I'm able to GET for taxonomy terms. It is only the POST for taxonomy terms that is causing problems.
The Drupal 8 and Drupal 9 setups are clean default installations with only the Web Services modules enabled using Drush. Both are using the exact same Drush script.
This is the script I am using to query the end point.
endpoint="http://example.org/entity/taxonomy/term/taxonomy_term?_format=hal_json"
curl --request POST \
-k \
-i \
-s \
--user "${BOT_USERNAME}:${BOT_PASSWORD}" \
--header 'Content-type: application/hal+json' \
-H 'Cache-Control: no-cache' \
"${endpoint}" \
--data-binary "@${json_file}"
This is the JSON file used from that script.
{
"_links": {
"type": {
"href": "http://example.org/rest/type/taxonomy_term/tags"
}
},
"vid": [
{
"target_id": "tags"
}
],
"name": [
{
"value": "RESTtag",
"lang": "en"
}
]
}
These are the enabled modules and the resource settings.