1
0
-1

Hi, I have just started using this Rest API today. I use it for my website. I have tested different URLs in my React but the data section is always empty. I used below example from https://documenter.getpostman.com/view/60615/SWT5j1e4?version=latest#intro

var axios = require("axios");
var data = "";



var config = {
method: "post",
url:
"https://test1-api.rescuegroups.org/v5/public/animals/search/available",
headers: {
"Content-Type": "application/vnd.api+json",
Authorization: "{{apikey}}",
},
data: data,
};

axios(config)
.then(function (response) {
console.log("RESPONSE", JSON.stringify(response));
})
.catch(function (error) {
console.log(error);
});


The answer I got is:

RESPONSE {"data":"","status":200,"statusText":"OK","headers":{"cache-control":"no-cache, must-revalidate","content-length":"0","content-type":"text/plain;charset=UTF-8","expires":"Mon, 26 Jul 1997 05:00:00 GMT"},"config":{"transformRequest":{},"transformResponse":{},"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/vnd.api+json","Authorization":"{{apikey}}"},"method":"post","url":"https://test1-api.rescuegroups.org/v5/public/animals/search/available/cats/haspic/?sort=random&limit=5","data":""},"request":{}}

Am I doing something wrong.I'd appreciate your help.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Parisa,

      Thanks for posting your question!

      A couple things don't look right to me on this, but I might just be looking at it wrong.

      First, the URL from your request (config var) doesn't seem ot match the URL in the response?

      Second, I see you are doing a POST but not providing any POST body. If you have no filters you can use GET instead.

      You may want to post to our Google Group instead of our User Guide. You might get a faster response as the community may be able to assist before RescueGroups.org can...

      https://groups.google.com/a/rescuegroups.org/g/apidev

      Hope that helps!

      Richard

        CommentAdd your comment...