我正在尝试让 Trigger.io 向 simperium 发出 HTTP 请求(https://simperium.com/docs/reference/http/)
我的电话看起来像:
forge.request.ajax({
url: 'https://api.simperium.com/1/app-id/somebucket/i/newitem?response=1',
headers: {
'X-Simperium-Token': "access-token",
},
type: 'POST',
dataType: 'json',
data: {
'test': 'test'
},
success: function (suc) {
forge.logging.info(JSON.stringify(suc));
// Upload complete - do nothing
},
error: function (err) {
forge.logging.info(JSON.stringify(err));
alert('Problem uploading the metadata');
}
});
然而触发器返回:
[FORGE] '{"type":"EXPECTED_FAILURE","message":"Error opening connection for ajax request"}'
打电话会有什么问题?谢谢。
更新:
看起来它适用于检索对象,但仍不适用于更新/创建新对象。这适用于获取对象:
forge.request.ajax({
url: 'https://api.simperium.com/1/app-id/sample/i/object-id',
headers: {
'X-Simperium-Token': "token",
},
type: 'GET',
success: function (suc) {
forge.logging.info(JSON.stringify(suc));
// Upload complete - do nothing
},
error: function (err) {
forge.logging.info(JSON.stringify(err));
alert('Problem uploading the metadata');
}
});