(Quick Reference) Service: Upsert an appointment

Description: This web service is used to insert an appointment object to the database if it does not already exist, or update it.

URL with external_id:

https://BASE_URL/api/VERSION/appointments/reference/{id}

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
title Stringyes 
startDate Stringyes2016-10-09T08:10:00Z
endDate Stringyes2016-11-09T08:10:00Z
note Stringno 
appointmentCategoryId Stringyes123
done Booleannotrue , false
customerId Stringno 
contactslist of contacts id of specified customer to be assigned to the appointmentListno[1,2,3,4] , [1]

Success Output

Success case: response.status = 201
{
  "id": 132,
  "reference": "ref-01",
  "title": "Check the rest",
  "note": "checking if the rest of merchandise is transfered",
  "startDate": "2016-10-12T09:20:00Z",
  "endDate": "2016-10-12T09:25:00Z",
  "done": true,
  "user": {
    "id": 4,
    "reference": "emp-00",
    "href": "/api/v1.0/users/4"
  },
  "customerId": 3230,
  "customer": {
    "id": 3230,
    "reference": "960",
    "name": "Flipopia",
    "href": "/api/v1.0/customers/3230"
  },
  "appointmentCategoryId": 1,
  "appointmentCategory": {
    "id": 1,
    "reference": "meeting",
    "name": "Rendez-vous",
    "href": "/api/v1.0/appointmentCategories/1"
  },
  "contacts": [
    {
      "id": 9,
      "href": "/api/v1.0/contacts/9"
    },
    {
      "id": 8,
      "href": "/api/v1.0/contacts/8"
    }
  ],
  "organization": "entity1",
  "dateCreated": "2016-10-12T11:28:34Z",
  "lastUpdated": "2016-10-12T11:28:34Z"
}

Failure Output

Failure case:response.status = 400
{
  "error": "missing_param",
  "error_description": "title parameter is missing"
}

{
  "error": "date_validation_error",
  "error_description": "Failed to add the appointment with the reference -: startDate incorrect Date Format"
}

{
  "error": "invalid_param_type",
  "error_description": "The type of parameter appointmentCategoryId you provided is not valid for this request."
}

{
     "error": "save_failed",
     "error_description": "Failed to save instance"
}

{
  "error": "not_found",
  "error_description": "The customer with the id 999 doesn't exist."
}
Failure case:response.status = 500
{
     "error": "server_error",
     "error_description": "Oops! Something went wrong..."
}