Bookings

The bookings API allows you to create, update and select bookings for students. You need to authenticate using an API Key in order to call these services; see the Authentication section for further details

Creating and updating bookings

URL
/v1/booking/{AgentBookingId}
HTTP Method
PUT
Client Library Message Name
Booking.PutBookingRequest

You should PUT details of your booking to the booking service to create or update a booking. The details of the booking should include your own unique id for the booking. The first time you PUT a booking with a specific ID we’ll create a new booking record in our system. When you need to update the booking then you just need to PUT the updated booking details with the same ID you specified when the booking was created and we’ll perform the update.

We’ll do some basic validation of your booking such as checking that all the required fields are filled in and that you’ve provided valid country codes. If the booking passes basic validation we’ll return an empty HTTP 200 OK response to let you know that we’ve handed the booking off to our back-end system for further processing; see Sample Response - Passed Basic Validation for a sample of this. If a booking fails validation then we’ll return a message that describes why the booking failed validation along with a HTTP 404 Invalid code; see Sample Response - Failed Basic Validation for a sample of this.

Our back-end system will do some more complex validation such as checking that the course you requested is offered by the desired centre at the required start date. You should register to be notified of bookings that fail validation and display the validation message to the member of staff that is responsible for the booking so they can fix the issue and resubmit the booking. You can see a sample of this notification in the Invalid booking notification section. Notifications are made using our Notifications system. This system allows you to be notified using a message over HTTP or to have an HTML email sent directly to the member of staff with details of the validation failure.

You can also register to be notified when our back-end system has finished creating the booking in our student management system by setting up a New booking notification.

Sample Request

Error

Failed to run contract transformer command: bin\Api.ContractTransformer.exe

{
            "AgentBookingId": "X8347848",
    "Booking": {
        "AgentOfficeCode": "2983",
        "AgentContact": {
            "FirstNames": "Anna",
            "LastName": "Polishchuk",
            "Email": "anna.polishchuk@agentcompany.com"
        },
        "SchoolCode": "S333",
        "LanguageLevel": "Intermediate",
        "Student": {
            "FirstNames": "Bobby",
            "LastName": "Smith",
            "PassportNumber": "4823 909 9838",
            "PassportIssuingCountryIsoCode": "ES",
            "DateOfBirth": "1993-02-20",
            "Gender": "Male",
            "CountryOfBirthIsoCode": "ES",
            "NationalityIsoCode": "ES",
            "Email": "bobby@example.com",
            "Telephone": "+34 93 412 46 02",
            "Mobile": "+34 09 456 888",
            "Address": {
                "Line1": "Torre Espacio",
                "Line2": "Paseo de la Castellana 259D",
                "City": "Madrid",
                "StateProvince": "",
                "PostalCode": "28046",
                "CountryIsoCode": "ES"
            },
            "EmergencyContact": {
                "Name": "Jane Smith",
                "Phone": "+34 09 123 233",
                "Relationship": "Mother"
            }
        },
        "Courses": [
            {
                "CourseCode": "C92",
                "DateFrom": "2016-03-14",
                "NumberOfWeeks": 3
            }
        ],
        "Accommodation": [
            {
                "AccommodationCode": "A78",
                "DateFrom": "2016-03-13",
                "NumberOfWeeks": 3
            }
        ],
        "OptionalExtras": [
            {
                "Quantity": "1",
                "OptionalExtraCode": "E33"
            }
        ],
        "Transfers": [
            {
                "TransferCode": "TRN88"
            }
        ],
        "SpecialRequirements": {
            "Allergies": "Allergic to nuts"
        }
    }
}

Sample Response - Passed Basic Validation

The response is empty. Use notifications if you want to receive our ID for a booking

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
Content-Length: 2

{}

Sample Response - Failed Basic Validation

This response will be returned along with a HTTP 404 Invalid code for bookings that fail basic validation.

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
Content-Length: 461

{
  "ResponseStatus": {
    "ErrorCode": "StringLength",
    "Message": "'FirstNames' must be between 0 and 100 characters",
    "Errors": [
      {
        "ErrorCode": "StringLength",
        "FieldName": "FirstNames",
        "Message": "'FirstNames' must be between 0 and 100 characters"
      },
      {
        "ErrorCode": "Required",
        "FieldName": "DateOfBirth",
        "Message": "'DateOfBirth' is required"
      }
    ]
  }
}

Request fields

Booking      
Field Type Required? Description
AgentBookingId text(50) Yes Unique identifier for the booking in the Agent system
AgentOfficeCode text(10) Yes EC code for the agent’s office, see Agent offices
AgentContact object Yes Agent contact for the booking - see the agent contact table below
SchoolCode text(10) Yes EC code for the school the student wishes to attend, see Schools
LanguageLevel text(20) No Language Level of the student - see Reference data
Student object Yes Details of the student - see Student table below
Courses array Yes An array of courses for the booking - see the Course table below
Accommodation array No An array of accommodation for the booking - see Accommodation table below
OptionalExtras array No An array of optional extras for the booking - see Optional Extras table below
Transfers array No An array of transfers for the booking - see Transfers table below
SpecialRequirements object No Any special requirements - see special requirements table below
HomestayPreferences object No Any homestay preferences - see the homestay preferences table below
Agent Contact
Field Type Required? Description
FirstNames text(100) Yes First (Given) names of the agent booking contact
LastName text(100) Yes Last (Family) name of the agent booking contact
Telephone text(20) No Phone number for the agent booking contact
Mobile text(20) No Mobile number for the agent booking contact
Email email Yes Email address of the agent booking contact
Student
Field Type Required? Description
FirstNames text(100) Yes First (Given) names of the student
LastName text(100) Yes Last (Family) name of the student
PassportNumber text(50) No The student’s passport number
PassportIssuingCountryIsoCode country Yes ISO code representing the student’s passport issuing country
DateOfBirth date Yes The student’s date of birth
Gender text(20) Yes Either Male or Female to indicate the gender
CountryOfBirthIsoCode country Yes ISO code of the country where the student was born, see Reference data
NationalityIsoCode country Yes ISO country code representing the student’s nationality, see Reference data
Email email No Email address of the student
Telephone text(20) No Phone number for the student
Mobile text(20) No Mobile number for the student
Address object Yes Home address for the student - see Address table below
EmergencyContact object No Emergency contact for the student - see Emergency Contact table below
Course
Field Type Required? Description
CourseCode text(10) Yes EC code of the course, see Products
DateFrom date Yes Start date of the course
NumberOfWeeks integer Yes Length of the course in weeks
Accommodation
Field Type Required? Description
AccommodationCode text(10) Yes EC code of the accommodation, see Products
DateFrom date Yes Start date of the accommodation
NumberOfWeeks integer Yes Number of weeks for the accommodation
Optional Extra
Field Type Required? Description
OptionalExtraCode text(10) Yes EC code for the type of optional extra required, see Products
Quantity integer Yes The number of units required
Transfers
Field Type Required? Description
TransferCode text(10) Yes EC code for the type of transfer required, see Products
Address
Field Type Required? Description
Line1 text(100) No First line of the student’s address
Line2 text(100) No Second line of the student’s address
City text(100) No City of the student’s address
StateProvince text(100) No State, county or province of the student’s address
PostalCode text(20) No Postal or zip code of the student’s address
CountryIsoCode country Yes ISO code for the student’s country of residence, see Reference data
Emergency Contact
Field Type Required? Description
Name text(100) No Name of the emergency contact
Phone text(20) Yes Phone number for the emergency contact
Relationship text(50) No Emergency contact’s relationship to the student
Special Requirements
Field Type Required? Description
MedicalCondition text(500) No Any medical conditions (except allergies) for the student
Allergies text(500) No Allergy information for the student
General text(500) No Any general booking requirements
Homestay Preferences
Field Type Required? Description
Smoking text(20) Yes NonSmoking, Smoking or NoPreference
Pets text(20) Yes NoPets, Pets or NoPreference
Children text(20) Yes NoChildren, Children or NoPreference
VegetarianMeals boolean Yes True if vegetarian meals are required, otherwise False

Invalid booking notification

You should register to be notified via our Notifications system about bookings that have failed validation and hence will not be loaded into our student management system. These validation messages are designed to make sense to business users and will have messages such as:

Start date 02/03/2015 isn’t a valid start date for General English and Brighton

You can choose to receive these messages as a HTTP message using JSON or XML, or to have an HTML email send directly to the user with details of the validation failure.

POST /your-url HTTP/1.1
Host: www.yoursite.com
Content-Type: application/json; charset=utf-8
Accept: application/json
X-EC-NotificationKey: secret-notification-key
Content-Length: 205

{
  "Topic": "Booking:Invalid",
  "AgentBookingId": "X8347848",
  "ValidationMessages": [
    {
      "Message": "02-10-2015 isn't a valid start date to 'General English' in 'Brighton'"
    }
  ]
}

New booking notification

You can register to be notified via our Notifications system when we’ve finished creating a new booking in our student management system. You’ll get a notification like the example below for each booking thats been processed.

You can also choose to have these details sent to a member of staff by email.

POST /your-url HTTP/1.1
Host: www.yoursite.com
Content-Type: application/json; charset=utf-8
Accept: application/json
X-EC-NotificationKey: secret-notification-key
Content-Length: 67

{
  "Topic": "Booking:Success",
  "AgentBookingId": "X8347848"
}