0
我正在嘗試使用V3 API創建事件。我送的參數是:無法使用API創建Eventbrite事件
var _event = {
"event" : {
"name": {
"html": "Test Event 01"
},
"description": {
"html": "Test Event 01"
},
"start": {
"timezone": "America/Chicago",
"utc": "2017-07-10T18:00:00Z"
},
"end": {
"timezone": "America/Chicago",
"utc": "2017-07-10T20:00:00Z"
},
"currency": "USD"
}
};
這就是我要打發使用的的NodeJS要求:
var request = require('request');
var _headers = {
'Authorization': 'Bearer ' + _token,
'Content-Type': 'application/json',
}
// Configure the request
var options = {
url: EVENTBRITE_API_URL + "events/",
method: 'POST',
headers: _headers,
form: _event
}
我自己也嘗試Content-Type: application/x-url-form-encoded
和內部options
,JSON.stringify(_event)
。我也試圖改變_event
對象:
var _event = {
"name": {
"html": "Test Event 01"
},
"description": {
"html": "Test Event 01"
},
"start": {
"timezone": "America/Chicago",
"utc": "2017-07-10T18:00:00Z"
},
"end": {
"timezone": "America/Chicago",
"utc": "2017-07-10T20:00:00Z"
},
"currency": "USD"
};
我已經嘗試了所有的組合,但我總是得到相同的迴應:
{
"status_code": 400,
"error_description": "There are errors with your arguments: event[currency] - Unknown parameter, event.start.timezone - This field is required., event.currency - This field is required., event.start.utc - This field is required., event[start][timezone] - Unknown parameter, event.end.utc - This field is required., event[end][utc] - Unknown parameter, event[description][html] - Unknown parameter, event[name][html] - Unknown parameter, event[end][timezone] - Unknown parameter, event[start][utc] - Unknown parameter, event.end.timezone - This field is required., event.name.html - This field is required.",
"error": "ARGUMENTS_ERROR"
}
有什麼樣創建活動要求的任何地方我可以看看?以上要求有什麼問題?
順便說一句,這種事情的一個有用的調試工具是https://requestb.in/。將您的API請求發送到那裏,而不是發送到Eventbrite API,並且您可以準確查看您要發送的內容。在那裏,我相信你會看到你發送一個表單編碼的身體而不是JSON。 – smarx
輝煌。絕對的輝煌。你救了我的一天! – User2682