我可以使用以下命令从解析中成功检索对象:
curl -X GET \
-H "X-Parse-Application-Id:1231231231" \
-H "X-Parse-REST-API-Key: 131231231" \
-G \
--data-urlencode 'where={"uid":"12312312"}' \
https://api.parse.com/1/classes/birthday`
Run Code Online (Sandbox Code Playgroud)
但我正在努力将其转换为javascript,使用下面的代码我会得到状态为的响应200.我假设错误是将data-urlencode转换为数据:
var getObject = function {
var url = "https://api.parse.com";
url += '/1/classes/birthday';
fetch(url, {
method: 'GET',
headers: {
'Accept': 'application/json',
'X-Parse-Application-Id': '12122',
'X-Parse-REST-API-Key': '12121',
'Content-Type': 'application/json',
},
data: '{"where":{"uid":"12312312"}}'
})
.then(function(request, results) {
console.log(request)
console.log(results)
})
}
Run Code Online (Sandbox Code Playgroud)
谢谢!