CIOPulse Knowledge Base

3.2 Relationship Survey Responses API v5

Updated on

By using the Relationship Survey Responses API endpoint, you can make an HTTP GET request to retrieve all (or a subset of) the survey responses completed for a particular Relationship Survey.

The API returns data in JSON format which is readily decodable by all modern programming languages.

To use the API you must be on our Corporate or Enterprise Plan and have a 40 character API key. The key can be found in the Portal at the bottom of the Preferences page. If your key is blank, please email us at [email protected].

Some ideas for what you could use the Relationship Survey Responses API endpoint for:

  1. Integrating feedback and results into your own reports.
  2. Calculating response rates.
  3. Sending customers a reminder if they don't complete a survey.

If you have setup IP address security in the CIOPulse Portal, the IP address of the server making the API call must be included in your list of valid IP addresses.

Authentication

All our API endpoints require HTTP basic authentication as specified in RFC 7616 from 2015. The HTTP Header of your request must contain a header field in the form of:

Authorization: Basic {credentials}

Where {credentials} is the Base64 encoding of: your Client Portal Code, a single colon, and your API Key (found in the Preferences of the Portal).

Here's a snippet of PHP script using CURL to set the authentication header.

$portal_code = 'ABC123'; 
$api_key = 'SMzYECYJYLpNw8PrfX8EtPO2tcP0XaKJvZ4FW5VL';

$header = array('Authorization: Basic '. base64_encode($portal_code .":". $api_key) );

$curl_session = curl_init();
curl_setopt($curl_session, CURLOPT_HTTPHEADER, $header);

Retrieving Relationship Surveys Responses

To use the Relationship Survey Responses endpoint, use the HTTP GET method with this URL:

https://app.cio-pulse.com/api/v5/rs-surveys

You can add any of the following parameters to this URL to define your filters. The first parameter must be prefixed with a ? and all subsequent parameters with a &:

Ths parameters defines the Relationship Survey you want to retrieve response for:

  • rsid Mandatory. The Relationship Survey Code of the Relationship Survey.

These optional parameters define the period of time you want to return the surveys for:

  • limit Optional. Specify a number, n, to limit the number of survey responses to the most recent n surveys that meet the selection criteria. n must be 10000 or less. Cannot be used with the isofrom, isoto or eom parameters.
  • isofrom Optional. Return responses received on or after this UTC/GMT date/time. The date/time must be in ISO8601 format:  yyyy-mm-ddThh:mm:ssZ, e.g. 2016-10-13T16:30:00Z. Cannot be used with the limit or eom parameters.
  • isoto Optional.  Return responses received on or before this UTC/GMT date/time. The date/time must be in ISO8601 format:  yyyy-mm-ddThh:mm:ssZ, e.g. 2016-10-14T16:29:59Z. Cannot be used with the limit or eom parameters.

These optional parameters define the Customer Segments you wish to retrieve surveys for:

  • sgid1 Optional. Include surveys for this Customer Segment 1.
  • sgid2 Optional. Include surveys for this Customer Segment 2

Additional filter parameters:

  • min Optional. Returns survey responses where overall satisfaction rating > = this value (1-10).
  • max Optional. Returns survey responses where overall satisfaction rating < = this value (1-10).

If the limit parameter is used, the isofrom and isoto parameters are ignored.

In the isofrom and isoto parameters, always use a T to separate the date from the time and always include the Z at the end. Although it is specified in the ISO8601 standard, do not attempt to specify an offset, such as -04:00 or +11:00.

The survey endpoint will return a maximum of 10000 survey responses. An HTTP 422 error will be returned if your parameters would result in more than 10000 surveys being returned.

Response

The surveys returned by the API look like this (which shows three surveys):

{"surveys":[

{"survey":{"Response_ID":"3","Relationship_Survey_Code":"JAN21","Relationship_Survey_Name":"RS 2021","Series_Code":"NONE","Series_Name":"No Series","Response_Datetime_UTC":"2021-01-10
08:50:12","Segment_Code":"Operations","Segment_Name":"Operations",
"Segment_2_Code":"Staff","Segment_2_Name":"Staff",
"Customer":"712017","Rating":"9","Rating_Reason":"Best IT department I've ever known","Suggested_Improvement":"Help desk at weekends would be nice",
"Survey_Description":"CIOPulse RS -
Democorp","Survey_Language":"English"}},

{"survey":{"Response_ID":"4","Relationship_Survey_Code":"JAN21","Relationship_Survey_Name":"RS 2021,"Series_Code":"NONE","Series_Name":"No Series","Response_Datetime_UTC":"2021-01-10
08:54:30","Segment_Code":"Sales","Segment_Name":"Sales",
"Segment_2_Code":"Staff","Segment_2_Name":"Staff",
"Customer":"711267","Rating":"6","Rating_Reason":"ERP system is clunky, slow and old fashioned","Suggested_Improvement":"Upgrade to a modern ERP!",
"Survey_Description":"CIOPulse RS - DemoCorp","Survey_Language":"English"}}

]}

Carriage returns (new lines) in the Rating_Reason and Suggested_Improvement fields will appear in the JSON as \n.  Quotes in these fields will be escaped and will appear as \".

Error handling

If there is a problem, one of these error codes will be returned in the HTTP header:

  • 401 Invalid security credentials (Client Portal Code and/or API key invalid).
  • 400 Malformed syntax, e.g. missing/invalid parameters.
  • 422 Valid syntax but not processed due to business rules (e.g. max > min or isoto > isofrom).
  • 404 No surveys found that match the criteria specified.
  • 500 Server error, e.g. database connection couldn't be established.

In each of these error situations, a description of the error will also be returned in JSON format.

{"message":"No surveys were found that matched this criteria","status":404}
Previous Article 3.1 Relationship Surveys API v5
Next Article 3.3 Relationship Survey Webhook