0
,我請求在node.js中的/ V1 /產品獲得特定區域中可用汽車的名單,但我得到這個:錯誤同時要求產品在尤伯杯API
{"fields":{"latitude":"Required","longitude":"Required"},"message":"Invalid request","code":"validation_failed"}
代碼:
var https = require('https');
var data = {
'latitude': '37',
'longitude': '-122',
};
data = JSON.stringify(data);
var options = {
host: "api.uber.com",
path: "/v1/products",
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Token myAppToken",
"Content-Length": Buffer.byteLength(data)
}
};
var req = https.request(options, function(res) {
var responseString = "";
res.on("data", function(data) {
responseString += data;
});
res.on("end", function() {
console.log(responseString);
});
});
req.write(data);
req.end();
已更新,我可以通過點擊瀏覽器中的url來獲得響應json – Aquarius24