【发布时间】:2015-11-13 00:07:01
【问题描述】:
我正在尝试使用 Parse Cloud Code 和 Firebase 的 REST API 从 Parse 向 Firebase 发出 POST 请求。
Parse.Cloud.define("createChatRoom", function(request, response) {
Parse.Cloud.httpRequest({
url: 'https://myapp.firebaseIO.com/' + '.json',
method: 'PUT',
body: {"hi": "hello"}
}).then(function(httpResponse) {
response.success("Successfully posted hello!");
},function(httpResponse) {
response.error("failed to post hello" + httpResponse.text)
})
})
但是,此代码使 Firebase 响应以下错误:
"Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names."
我已经为body 尝试了多种组合,包括撇号、整数的变体以及完全删除括号。
有什么想法吗?
【问题讨论】:
标签: json parse-platform firebase