以下是它运作的cURL请求:
curl -H
'X-New-ID: weR1RRzRw3R3R3Rz1'
-H 'Brand: 1'
-H 'X-Device-Version: 4.02'
-H 'X-Device-Source: 6'
-H 'Accept-Language: en-US'
-H 'Content-Type: application/json'
-H 'User-Agent: Dalv1k/2.1.0 (Linux; U; Andr0id 5.1; Go0gle Nexus 10 - 5.1.0 - API 22 - 2560x1600_1 Build/LM227D)'
-H 'Host: api.autoigs.com'
--data-binary '{"areaId":10,"cityId":1,"countryId":1,"kickId":0}' --compressed 'https://api.autoigs.com/apiAndroid/v1/kicks'
不幸的是,我也无法解决这个问题(比如来自cli的curl)虽然我想使用nodejs发送此请求。我该怎么做?
答案 0 :(得分:0)
使用request
包,您可以这样做:
const request = require('request');
request.post({
url: 'https://api.autoigs.com/apiAndroid/v1/kicks',
form: {"areaId":10,"cityId":1,"countryId":1,"kickId":0},
json: true,
headers: {
'X-New-ID': 'weR1RRzRw3R3R3Rz1',
'Brand': '1',
'X-Device-Version': '4.02',
'X-Device-Source': '6',
'Accept-Language': 'en-US',
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 10 - 5.1.0 - API 22 - 2560x1600_1 Build/LMY47D)',
},
}, function(err, response, body) {
if(err) {
console.error('error', err);
// handle error!
return;
}
// body contains response body
console.log(body);
});