Request parameters are sent to the API endpoints as query string values. The following details all the valid request parameters for the CMS API v2.4.
All requests require the inclusion of the following parameters.
Parameter | Description |
---|---|
api_id (or) access_key |
The api_id is given to you with your access credentials.When accessing endpoints for publicly accessible datasets, an access_key can be used instead of an api_id .
|
data | The URL encoded JSON data string of search parameters. |
sig | The HMAC signature for this request. |
Depending on the API endpoint used, some optional request parameters may also be included. Full details of which optional request parameters each API endpoint accepts can be found on the each of the documented API endpoint pages.
Parameter | Description |
---|---|
end_date | Only return records that were updated on or before this date. Dates must be formatted in the following format: YYYY-MM-DD HH:MM . |
fields |
A URL encoded JSON string of fields that should be included with the response. If fields are not included then the CMS API v2.4 will use a default set of fields. For example: {"contact":["forenames","surname","known_as_forenames"]} To retrieve a list of available fields the CMS API v2.4 supports, please refer to the following API endpoints: |
limit | The number of records to return. The default is 100 records. The maximum records you can return in one response is 1000. |
offset | The number of rows to skip before beginning the returned rows. |
start_date | Only return records that were updated on or after this date. Dates must be formatted in the following format: YYYY-MM-DD HH:MM . |
$api_id = 'XX'; $secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $params = [ 'keyword' => 'smith', 'date_period' => 'present', 'diocese_id' => 'XXXX', 'sort_order' => 'surname_then_known_as_desc' ]; $limit = 10; $offset = 0; $start_date = '2016-10-12 00:01'; $end_date = '2016-11-01 00:01'; $fields = json_encode(['contact' => ['title','forenames','surname']]);; $data = json_encode($params); $sig = hash_hmac ( 'sha256' , $api_id.$data.$end_date.$fields.$limit.$offset.$start_date, $secret_key); $url = 'https://cmsapi.cofeportal.org/v2/contacts?api_id='.$api_id.'&data='.urlencode($data).'&sig='.$sig.'&end_date='.$end_date.'&fields='.urlencode($fields).'&limit='.$limit.'&offset='.$offset.'&start_date='.$start_date;