如何知道来自rest api的数组的最终数据

问题描述 投票:0回答:1
const url = " https://nimbus.wialon.com/api/depot/4054/routes ";
fetch (url, {
  método: "GET",
  con credenciales: verdadero,
  encabezados: {
    "Autorización": "Token 3d188d86b6384e3fb71c71d919831f52",
    "Content-Type": "application / json"
  }
})
.then (resp => resp.json())
.then (function (data) {
  console.log(data.routes).lenght;
})
javascript api sightly
1个回答
0
投票

我注意到某些错别字和信息可能会丢失。通过轻微的语法修复,我看到收到了响应。似乎存在用户身份验证问题,但是与服务器的通信似乎正常。

const url = " https://nimbus.wialon.com/api/depot/4054/routes ";
fetch(url, {
  método: "GET",
  credenciales: 'verdadero',
  encabezados: {
    Autorización: "Token 3d188d86b6384e3fb71c71d919831f52",
    "Content-Type": "application / json"
  }
})
  .then(resp => resp.json())
  .then(function(data) {
    console.log("response: ", data);
  });
© www.soinside.com 2019 - 2024. All rights reserved.