CourseSales.com Web Services - Course Date

Tuesday, Sep 24, 2013

Swagger Definition

Refer to the swagger file for a full definition

Standard Web Service

This web service requires a standard CourseSales.com web services user. It may be used in client or server-side applications.

Call pattern

Besides the login details as specified for SOAP and REST, this call requires you to request the specific Course Dates information you require.

Requests are made through an array, and all requests are structured according to the same pattern:

$request['Course Dates'] = array();
$request['Course Dates']['CourseDateType'] = array();
$request['Course Dates']['CourseDateType'][] = CourseDateType; ( one of "ActiveYearMonth", "CourseDateList", "CourseDateFiles", "CourseDateLocationCheapest", "CourseDateLocationNext", "CourseDateMap" )

Scope

This service returns Active Course Dates, that is:

  • They are Scheduled, and visible to the Public

  • Where the Course Date is attached to a Course Master that has a status of Active

Request Types

  • ActiveYearMonth A list of years and months for which there are Active Course Dates

  • CourseDateList Details of Course Dates that match the search criteria

  • CourseDateFiles Links to files stored in CourseSales.com related to a Course Date. This is usually used as part of an Ajax request to get more information

  • CourseDateLocationCheapest A list of the cheapest Course Dates for each Course Category at a given Location

  • CourseDateLocationNext A list of the next Course Dates for each Course Category at a given Location

  • CourseDateMap Includes Venue information in the Course Date list

Multiple requests

The CourseDateType enables you to request different types of Course Date information simultaneously, eg:

$request['Course Dates'] = array();
$request['Course Dates']['CourseDateType'] = array();
$request['Course Dates']['CourseDateType'][] = "CourseDateList";
$request['Course Dates']['CourseDateType'][] = "CourseDateLocationCheapest";

Query Parameters

You may also add global query parameters to your request. These parameters will be applied to each part of your request.

  • Course Provider Integer - the Id of a Course Provider

  • Course Location Integer - the Id of a Course Location (All locations which have this Location on their branch will be included)

  • CourseDateDiscount Boolean - whether to include only discounted courses (determined by whether the Current Price is less than the Recommended Retail Price)

  • CourseDateDateFrom Date - d/m/y (returns Course Dates with a Start Date greater than or equal to the date provided)

Example

$request = array();
$request['Course Location'] = 123;
$request['Course Dates'] = array();
$request['Course Dates']['CourseDateType'] = array();
$request['Course Dates']['CourseDateType'][] = "CourseDateList";

Response

The response is an array like the one below, where each part of the request is returned as part of the overall response.

Array (
  [Course Dates] => Array
    (
      (
        [CourseDateList] => Array
            (
                [37] => Array
                    (
                        [0] => 37
                        [1] => 2010-07-18
                        [2] => 2010-07-18
                        ... etc etc etc

                    )
            )
   )
        [CourseDateList meta] => Array
             ( [CourseDateId] => 0
               [CourseDateStart] => 1
               [CourseDateEnd] => 2
               ... etc etc etc
             )
          )
   )
)

CourseSales.com minimises the size of the message by providing meta data about the response only once for each request. You can use this data to decode the position of the data you need using a name.

eg $name = $result['Course Dates'][37][$result['CourseDateList meta']['CourseDateStart']];