Null object returned when fetching from Shippo API

134 Views Asked by At

I'm trying to get a list of all my shipments from the Shippo API. I'm using the fetch() API to get the data.

This is my code:

fetch("https://api.goshippo.com/shipments/", {
  method: "GET",
  withCredentials: true,
  headers: {
    "Content-Type": "application/json",
    Authorization: `ShippoToken ${shippoToken}`
  }
})
  .then(response => {
    console.log(response);
    return response.json();
  })
  .then(data => {
    console.log(data);
    return data;
  })
  .catch(() => {
    console.log("Can't access url");
  });
}

Here is a picture of what's happening in the console :

image

I'm getting a valid response but the object returned from the response's JSON has null next, null previous, and an empty array of results even though I have shipments in my account. I'm currently using a shippo_test token as my shippoToken.

0

There are 0 best solutions below