- Issue created by @bogdog400
Can you please add to the issue summary the GET requests you are sending, preferably as CURL commands?
- 🇺🇸United States bogdog400
My GET commands aren't working, but the POSTs are.
Above I noted that I was having trouble figuring out the JSON schema. This project helped me but only after I did a clean installation on 9.5.3. When I added fields to the article type in the 9.5.3, I could use the explorer to browse the GET response to guess at the right fields to put into the POST. As expected, these fields were unchanged in the version running on 10.0.3.
https://www.drupal.org/project/jsonapi_explorer →
BTW, my biggest hassle was figuring out that cross origin scripting was blocking the JSON calls from the explorer. When I turned that off, I was able to get it to work.
- Status changed to Closed: works as designed
almost 2 years ago 12:49am 8 February 2023 - 🇺🇸United States camchandler98
This is the output I got doing a GET request for all articles.
Tested with a local drupal instance using Postman, Google Chrome, and cURL{"jsonapi":{"version":"1.0","meta":{"links":{"self":{"href":"http:\/\/jsonapi.org\/format\/1.0\/"}}},"parsed":true},"data":[{"type":"node--article","id":"a3250a45-5069-4790-96b0-279ddd3bcf73","links":{"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/a3250a45-5069-4790-96b0-279ddd3bcf73?resourceVersion=id%3A16"}},"drupal_internal__nid":5,"drupal_internal__vid":16,"langcode":"en","revision_timestamp":"2023-02-07T23:47:40+00:00","revision_log":null,"status":true,"title":"test 1","created":"2023-02-07T23:47:28+00:00","changed":"2023-02-07T23:47:40+00:00","promote":true,"sticky":false,"default_langcode":true,"revision_translation_affected":true,"path":{"alias":null,"pid":null,"langcode":"en"},"body":{"value":"\u003Cp\u003Etest 1\u003C\/p\u003E","format":"basic_html","processed":"\u003Cp\u003Etest 1\u003C\/p\u003E","summary":""},"comment":{"status":2,"cid":0,"last_comment_timestamp":1675813660,"last_comment_name":null,"last_comment_uid":1,"comment_count":0},"node_type":{"type":"node_type--node_type","id":"18971097-f4d9-44c8-a643-8546d9d09652","meta":{"drupal_internal__target_id":"article"}},"revision_uid":{"type":"user--user","id":"2983dfbb-a8bf-460f-85cc-ceac0d1e248a","meta":{"drupal_internal__target_id":1}},"uid":{"type":"user--user","id":"2983dfbb-a8bf-460f-85cc-ceac0d1e248a","meta":{"drupal_internal__target_id":1}},"field_image":{"data":null,"links":{"related":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/a3250a45-5069-4790-96b0-279ddd3bcf73\/field_image?resourceVersion=id%3A16"},"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/a3250a45-5069-4790-96b0-279ddd3bcf73\/relationships\/field_image?resourceVersion=id%3A16"}}},"field_tags":{"data":[],"links":{"related":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/a3250a45-5069-4790-96b0-279ddd3bcf73\/field_tags?resourceVersion=id%3A16"},"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/a3250a45-5069-4790-96b0-279ddd3bcf73\/relationships\/field_tags?resourceVersion=id%3A16"}}}},{"type":"node--article","id":"95c0f6c6-7334-414c-b94a-9cbd13234ebd","links":{"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/95c0f6c6-7334-414c-b94a-9cbd13234ebd?resourceVersion=id%3A17"}},"drupal_internal__nid":6,"drupal_internal__vid":17,"langcode":"en","revision_timestamp":"2023-02-07T23:47:59+00:00","revision_log":null,"status":true,"title":"test 2","created":"2023-02-07T23:47:45+00:00","changed":"2023-02-07T23:47:59+00:00","promote":true,"sticky":false,"default_langcode":true,"revision_translation_affected":true,"path":{"alias":null,"pid":null,"langcode":"en"},"body":{"value":"\u003Cp\u003Etest 2\u003C\/p\u003E","format":"basic_html","processed":"\u003Cp\u003Etest 2\u003C\/p\u003E","summary":""},"comment":{"status":2,"cid":0,"last_comment_timestamp":1675813679,"last_comment_name":null,"last_comment_uid":1,"comment_count":0},"node_type":{"type":"node_type--node_type","id":"18971097-f4d9-44c8-a643-8546d9d09652","meta":{"drupal_internal__target_id":"article"}},"revision_uid":{"type":"user--user","id":"2983dfbb-a8bf-460f-85cc-ceac0d1e248a","meta":{"drupal_internal__target_id":1}},"uid":{"type":"user--user","id":"2983dfbb-a8bf-460f-85cc-ceac0d1e248a","meta":{"drupal_internal__target_id":1}},"field_image":{"data":null,"links":{"related":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/95c0f6c6-7334-414c-b94a-9cbd13234ebd\/field_image?resourceVersion=id%3A17"},"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/95c0f6c6-7334-414c-b94a-9cbd13234ebd\/relationships\/field_image?resourceVersion=id%3A17"}}},"field_tags":{"data":[],"links":{"related":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/95c0f6c6-7334-414c-b94a-9cbd13234ebd\/field_tags?resourceVersion=id%3A17"},"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article\/95c0f6c6-7334-414c-b94a-9cbd13234ebd\/relationships\/field_tags?resourceVersion=id%3A17"}}}}],"links":{"self":{"href":"https:\/\/drupal-api.ddev.site\/jsonapi\/node\/article"}}}
I think the trouble getting the correct about may be something with your configuration.
As for getting an individual resource JSONAPI expects the format
http://example.com/jsonapi/{entity_type_id}/{bundle_id}/{entity_uuid}
where entity_uuid is the uuid not the nid. To get a resource by nid try this formathttp://example.com/jsonapi/node/article?filter[drupal_internal__nid]=5
- 🇮🇩Indonesia yalasta
I have same issue, fresh installation of 10.0.3, every get request /jsonapi/node/article or /jsonapi/user/user get same error response (500) with details "Expected a scalar value as a 2nd argument to \"Symfony\\Component\\HttpFoundation\\InputBag::get()\", \"array\" given."
- 🇮🇩Indonesia yalasta
I found out jsonapi extras module caused this problem, this patch will fix it https://www.drupal.org/project/jsonapi_extras/issues/3331874 🐛 $request->get may no longer return array as of Symfony 6.0 Fixed
- Status changed to Needs work
almost 2 years ago 9:39am 8 April 2023 - 🇪🇸Spain rteijeiro
Reopening this issue as I'm getting the same error when trying to access a single node using
/jsonapi/node/page/1
end point in a GET request. It actually works when accessing all nodes of one type using/jsonapi/node/page
in a GET request. I'm not using jsonapi_extras module or anything else but jsonapi and serialization modules in core. Just created a Basic Page for testing.The error I get is the same described in the issue title:
{"title":"Not Found","status":"404","detail":"The \u0022entity\u0022 parameter was not converted for the path \u0022\/jsonapi\/node\/page\/{entity}\u0022 (route name: \u0022jsonapi.node--page.individual\u0022)"
I assume the issue is related to the parameter "1" encoding or something but can't see anything in the documentation.
- Status changed to Closed: works as designed
almost 2 years ago 9:48am 8 April 2023 - 🇪🇸Spain rteijeiro
My bad, I was using the node id instead the uuid as specified in the documentation. Closing again.
- 🇬🇧United Kingdom rajjubajra
I found "JSON API Defaults" caused this problem. after uninstalling "JSON API Defaults" it worked.