lundi 13 février 2017

Google Calendar Events API for Insert throwing 400

Vote count: 0

I have checked out other posts related to this issue and they are not the same: I am using "response", I copied the date/time from the google api website so the format is correct, and I've played around with the headers. Any other ideas for why this is not working?

I'm getting the following error:

Error: failed [400] {  "error": {   "errors": [    {     "domain": "global",     "reason": "required",     "message": "Missing end time."    }   ],   "code": 400,   "message": "Missing end time."  } } [object Object]

My code below broken down into steps: the url i'm going to POST, the user access token, the options for the inserted calendar event including headers and the event with start, end and event summary, and the actual http post and callback function:

calendarSchedule() {
    if(Meteor.user() && moment(Meteor.user() > moment()._d) {
      var url = "";
      var userAccessToken = Meteor.user();

      var options = {
        headers : {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer ' + userAccessToken,
          'X-JavaScript-User-Agent': "Google APIs Explorer",
        calendarId: 'primary',
        resource : {
          start: { dateTime: "2016-05-03T18:03:58+02:00" },
          end: { dateTime: "2016-05-03T18:03:58+02:00" },
          summary: "testSummar",
      };, options,
        function(error,result) {
          console.log("posted to calendar? "+ error+ result);

asked 1 min ago

Let's block ads! (Why?)

Google Calendar Events API for Insert throwing 400

Aucun commentaire:

Enregistrer un commentaire