CoursePricer

API DOCUMENTATION

Overview

Introduction

CoursePricer allows students to generate course quotes.

Things you should know

  • A registered CoursePricer account is required in order to use the API. More information can be found here: https://www.coursepricer.com.
  • SSL/HTTPS Only requests must come via HTTPS for security reasons.

CoursePricer API Flow

A typical flow is described in the flow-chart below:

CoursePricer flow diagram

The diagram below should help you build up a request to the quotations endpoint:

CoursePricer Quotation flow diagram

API Reference

Endpoint URL

The CoursePricer API is built on REST principles. Authenticated users can interact with any of our URIs by using the specified HTTP request method and endpoint.

https://api.coursepricer.com

SSL encryption is required for all requests.

Authentication

All requests to the CoursePricer API require authentication. In order to do this you must send the correct HTTP header with the correct API token. CoursePricer has one type of API token:

  • Account Token – Authorization

    The token is used for all API requests. This token is only accessible by the account owner, and can be found in the API section of your CoursePricer account.

Schools - all

Retrieve all school uids and/or school details.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.

Parameters

expand optional
If set to true, complete school details will be retrieved. Default is false.
region NEW optional
If set to a region string e.g. "Ireland", schools from that region will be returned.
get

/schools

Example request with curl

curl "https://api.coursepricer.com/schools" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"
curl "https://api.coursepricer.com/schools?expand=true" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/schools', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();
<?php
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/schools?expand=true', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();

Schools - single school

Retrieve all details of a single school by uid.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.
get

/schools/{uid}

Example request with curl

curl "https://api.coursepricer.com/schools/<School UID value>" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/schools/<School UID value>', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();

Courses - all

Retrieve all course uids and/or course details.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.

Parameters

expand optional
If set to true, complete course details will be retrieved. Default is false.
active_only potentially required
If set to false, inactive courses will be included. Default is true.
remove_expiring_courses optional
If set to true, all courses that are due to expire within 7 days will be removed. Default is false.
school_uid optional
If set to a school uid, all courses that are related to this school will be retrieved. Default is all courses that the API user has access to.
get

/courses

Example request with curl

curl "https://api.coursepricer.com/courses" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"
curl "https://api.coursepricer.com/courses?expand=true&active_only=true&remove_expiring_courses=true" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/courses', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();
<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/courses?expand=true&active_only=true&remove_expiring_courses=true', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();

Courses - single course

Retrieve all details of a single course by uid.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.
get

/courses/{uid}

Example request with curl

curl "https://api.coursepricer.com/courses/<Course UID value>" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/courses/<Course UID value>', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);
    
    echo $res->getBody();

Quotations - all

Retrieve all quotation details.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.

Parameters

expand optional
If set to true, complete quotation details will be retrieved. Default is false.
limit optional
If set to a number, n, the result set will be limited to n results. Default is 1000.
get

/quotations

Example request with curl

curl "https://api.coursepricer.com/quotations" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"
curl "https://api.coursepricer.com/quotations?limit=2000" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/quotations', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();
<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/quotations?limit=2000', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();

Quotations - single quotation

Retrieve all details of a single quotation by uid.

Request headers

Content-Type required
application/json
Authorization required
This token can be found inside the API section of your CoursePricer account.
get

/quotations/{uid}

Example request with curl

curl "https://api.coursepricer.com/quotations/<Quotation UID value>" \
    -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"

Example request with Guzzle

<?php 
    $client = new GuzzleHttp\Client();

    $res = $client->request('GET', 'https://api.coursepricer.com/quotations/<Quotation UID value>', [
        'headers' => [
            'Authorization' => 'Bearer <Your API Token>',
            'Content-Type' => 'application/json'
        ]
    ]);

    echo $res->getBody();

Quotations - get a quotation

Generate a quotation by sending parameters.

Request headers

Content-Type required
application/x-www-form-urlencoded
Authorization required
This token can be found inside the API section of your CoursePricer account.

Parameters

course_id required
The id of the course.
Note: this is not the uid of the course, search for the course using a uid to retrieve its id.

For courses that are setup with multiple 'fixed start AND finish dates' options inside CoursePricer Admin ('Course Dates and Pricing - Standard'), the course id will need to be in the format of 999-0 where 999 is the course id and 0 is the first option for that course. Send 999-1 or 999-2 for the following dates. Alternatively, inspect how CoursePricer does this natively... the option value inside the course name <select></select> is the value you'll need in order to generate a quotation for this course.
sessions_chosen potentially required
If the course is setup using session defined dates then an array of session option ids must be sent.
start_date potentially required
If the course does not have a fixed_dates value of 1 and is not setup using session defined dates then a start date must be sent.
Warning: if the course has a 'fixed_dates' value of 'true', this date must match a date inside the 'course_fixed_dates_start_dates' array.

Tip: Inspect the contents of the 'dates_for_quotation' array that is returned via a GET request to a course.
end_date potentially required
If the course does not have a fixed_dates value of 1 and is not setup using session defined dates then an end date must be sent.
periodic_options optional
If a quote is to include optional periodic options then an array of optional periodic option array ids must be sent.
Tip: Optional Periodic Options are the items that are listed after course options items in the 'Optional Extras' section of the CoursePricer front-end.
weekly_course_options optional
If a quote is to include weekly course options then an array of weekly options array ids must be sent.
Tip: Weekly Course Options are the items that are listed at the beginning of the 'Optional Extras' section of the CoursePricer front-end.
misc_weekly_options optional
If a quote is to include misc weekly options then an array of misc weekly option array ids must be sent.
Tip: Misc Weekly Options are the items that are listed after periodic options items in the 'Optional Extras' section of the CoursePricer front-end.
misc_other_options optional
If a quote is to include misc weekly options then an array of misc weekly option array ids must be sent.
Tip: Misc Other Options are the items that are listed after misc weekly options items in the 'Optional Extras' section of the CoursePricer front-end.
misc_extra_options optional
If a quote is to include misc extra options then an array of misc extra option array ids must be sent.
Tip: Misc Extra Options are the items that are listed after misc other options items in the 'Optional Extras' section of the CoursePricer front-end.
accommodation_option optional
If a quote is to include a quote for accommodation then the accommodation id must be sent.
Tip: To get all accommodation options for the course, merge the results of the course 'standard_accommodation' and 'non_standard_accommodation' return values together. The ID you need is the array key of the accommodation option after merging.
accommodation_extras optional
If a quote is to include a quote for accommodation extras then an array of accommodation extra ids must be sent.
Tip: The id is simply the array key of all accommodation extra options
airport_transfer optional
If a quote is to include a quote for an airport transfer then the airtport transfer id must be sent.
Tip: The id is simply the array key of all airport transfer options
post

/quotations

Example request with curl

curl "https://api.coursepricer.com/quotations" \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <Your API Token>"
    -d '{"course_id":"<Course Id (not UID)>","start_date":"<yyyy-mm-dd>","end_date":"<yyyy-mm-dd>"}'

Example request with Guzzle

<?php 
    $client = new GuzzleHttp\Client();

    $data = [ 
    'headers' => [
        'Authorization' => 'Bearer <Your API Token>',
        'Content-Type'  => 'application/json'
    ],
    'json' => [
        'course_id'  => '<Course Id (not UID)>',
        'start_date' => '<yyyy-mm-dd>',
        'end_date'   => '<yyyy-mm-dd>'
        ]
    ];

    $res = $client->post('https://api.coursepricer.com/quotations', $data);

    echo $res->getBody();