Create Appointment Rest API Bad Request

I’m trying to Create an Appointment Using Post. I have tried the ‘Try’ feature on that page with every conceivable input permutation. It always returns ‘0’ no response from server. From my app I get ‘400’ Bad Request.

From my app I have tried putting the access token in the query string ‘?access_token=’ as well as in the ‘Authorization’ header. I can GET and PUT without issue.

{“contact_id”:17,“description”:“Cutout stuff on the laser.”,“end_date”:“2020-02-07T17:00:00.000Z”,“location”:“Shop”,“remind_time”:0,“start_date”:“2020-02-07T20:00:00.000Z”,“title”:“Laser Shenanigans”,“user”:1}
.Status.Code=400
.Status.Text=BadRequest
.ErrorString=WEX: ProtocolError The remote server returned an error: (400) Bad Request.

Any help would be appreciated.

I’m not sure without digging down through the format conversions, but could you try an offset format of “2020-02-07T17:00:00.000-00:00” for the dates instead of “2020-02-07T17:00:00.000Z”?

Sorry for the delay. Still no joy. Getting the same thing:
Posting Json data to the following url/url+Auth header all yield the same response.

https://api.infusionsoft.com/crm/rest/v1/appointments?access_token=<token>

https://api.infusionsoft.com/crm/rest/v1/appointments/?access_token=<token>

https://api.infusionsoft.com/crm/rest/v1/appointments
Authorization: Bearer <token>

{“contact_id”:17,“description”:“Cutout stuff on the laser.”,“end_date”:“2020-02-07T17:00:00.000-00:00”,“location”:“Shop”,“remind_time”:0,“start_date”:“2020-02-07T20:00:00.000-00:00”,“title”:“Laser Shenanigans”,“user”:1}

.Status.Code=400
.Status.Text=BadRequest
.ErrorString=WEX: ProtocolError The remote server returned an error: (400) Bad Request.

Testing with this payload, via POST to https://api.infusionsoft.com/crm/rest/v1/appointments with the following Headers

{
      "title": "Laser Shenanigans",
      "description": "Cutout stuff on the laser",
      "user": 1,
      "location": "Shop",
      "start_date": "2017-11-21T16:46:50.000Z",
      "end_date": "2017-11-22T16:46:50.000Z",
      "remind_time": 0
}
Authorization: Bearer <access token>
Content-Type: application/json

I receive the following response with a 201 Status Code:

{
    "id": 6,
    "title": "Laser Shenanigans",
    "description": "Cutout stuff on the laser",
    "user": 1,
    "location": "Shop",
    "url": "https://api.infusionsoft.com/crm/rest/v1/appointments/6",
    "contact_id": null,
    "creation_date": "2020-02-04T23:18:25.000Z",
    "modification_date": "2020-02-04T23:18:25.000Z",
    "start_date": "2017-11-21T16:46:50.000Z",
    "end_date": "2017-11-22T16:46:50.000Z",
    "remind_time": 0
}

I would verify that Contact #17 exists in your application, that the Headers are correct (both are required), and that you aren’t receiving any additional error description with that status code; we generally provide a message should validation on a request fail.

Welp this is a head scratcher. I copied and pasted your json and it worked. I’ll go over mine to see where I’ve got the typo. Thanks for the assist. :smiley: :+1: I’ll update this post when I find the specific cause.

I’m an idiot. Had the start time and end time reversed. Again, thanks for the assist.

1 Like