Re: How to use query parameters with POST request in v5?

51 views
Skip to first unread message
Message has been deleted

Richard Saffell

unread,
Mar 30, 2022, 8:00:47 PM3/30/22
to apidev, Matthew Sudekum
Matthew,

A response body is included with the 400 client error code. In the example you provided, the error detail is "Invalid sort: distance". If you change your sort parameter to "orgs.distance" the query will work as you expected.

Richard


On Wednesday, March 30, 2022 at 7:57:02 PM UTC-4 Matthew Sudekum wrote:
I tried:
const response = await fetch('https://api.rescuegroups.org/v5/public/orgs/search', {
      method: 'POST',
      headers: {
        'Content-Type':'application/vnd.api+json',
        'Authorization': apiKey
      },
      body: JSON.stringify({
        data: {
          'filterRadius':{
            'postalcode': postalcode,
            'miles': distance
          }
        }
      })
    });
Which works. But when i try to add '/?sort=distance' to the end of the url, it returns a status code of 400. Is it impossible to add query parameters to POST requests or how can I add them correctly?
Reply all
Reply to author
Forward
Message has been deleted
0 new messages