TABLE OF CONTENTS
- API Setup
- Business Use Case
- How to use
- Good to Know
- Authentication
- Endpoint
- Request
- Response
- How to know the Data Set for your system?
- Examples
- Not the API you're looking for?
API Setup
Choose your Host Region to have the documentation adapt to your use case.
Host Region | |
---|---|
Label | Value |
EU | eu |
US | us |
AU | au |
Business Use Case
The GET Responses API is used to request responses from your CustomerGauge system. All responses returned will contain a base set of data, and can be expanded with Drivers, Additional Questions, Tags/Topics, and Segment data. This is ideal to populate your data lake on a daily basis.
How to use
How to call
This API is designed to be used to populate a data lake. As such, there are two times when you'd want to call the API:
- Initially: when you start out, and you want to populate your data lake with all your CustomerGauge Survey Responses.
- Periodically: after you have done the initial population, you'd want to keep it up to date with any new CustomerGauge Survey Responses.
How to call initially
When you're starting out, you make your first call without a cursor parameter, and a per_page=1000 parameter. Store the cursor value that gets returned from this first call in a permanent place. Then call the API again, passing the cursor value in the cursor parameter. Repeat this process until you have received all your responses (you're done when the "data" array is empty).
How to call periodically
After you've done the initial load, you'd want to set up a periodic process to keep your data lake in sync. Call the API with the cursor you have stored during the initial load. Store the cursor that gets returned, like you did during the initial load. You can repeat this process periodically (hourly, daily, weekly, etc.). The most frequent intended use is hourly - if you need responses more frequently, use Outgoing Webhooks instead.
Traversing the data set
Each response will contain a Cursor that you can use to call the next data set. You can store the cursor and call the API the next time, using the stored cursor to get the latest data.
Good to Know
Up to 1000 responses are returned per page and ordered by our internal primary key, oldest first. The request will also return a cursor parameter value which is used to navigate to next page or previous page.
Authentication
OAuth2 Authentication is used to connect to this API. In order to create the Connected App, which is needed to generate the Access Token, Administrator access to CustomerGauge is needed. Once you've created your Connected App, you can acquire a Bearer Access Token by calling our OAuth2/Token API:
curl -X POST -H "Content-Type: application/x-www-form-urlencoded"
-d "grant_type=client_credentials&client_id={{ Client ID }}&client_secret={{ Client Secret }}"
https://auth.{{ apiRegion }}.customergauge.com/oauth2/token
The acquired Bearer Access Token is used in the Authorization header in your API request.
Endpoint
Endpoint URL
https://api.{{ apiRegion }}.customergauge.com/v7/rest/sync/responses
Request
Parameters
Key | Description | Rules | Example |
---|---|---|---|
per_page | Defines the amount of responses returned per page. | Number from 1 to 1000. | per_page=100 |
cursor | Parameter value returned from the API to navigate pages. The cursor is an integer. | Value is returned from the API. | cursor=123 |
with[] | Defines additional information to be returned by the API, under the same key. selected_drivers - returns the reasons for the NPS Score. tags - returns Manual Tags and Text Analytics Topics with sentiment. questions - returns additional questions, CES, CSAT and Rating questions and their answers. properties - returns segment information about the Survey Record. salutation - returns the value saved in the salutation field. rand_value - returns the order value of the record. | "selected_drivers", "tags", "questions", "properties", "salutation" and/or "rand_value". | with[]=selected_drivers&with[]=tags |
number_customergauge | Filters a specific CGID. | Numbers | number_customergauge=45778 |
filter | Filters the data using the Outbound filter setup. | Value is the reference provided in Outbound filter setup. | filter=147b3662-cd7e-490c-b865-9be3480ca2fd |
period[field] | Specifies the date type which will be returned. | Values: date_creation; date_order; date_sent; date_survey_response. | period[field]=date_creation |
period[start] | Defines the period start date. | yyyy-mm-dd format. | period[start]=2023-01-05 |
period[end] | Defines the period end date. | yyyy-mm-dd format. | period[end]=2023-01-25 |
Example Request
https://api.{{ apiRegion }}.customergauge.com/v7/rest/sync/responses?per_page=25
Response
Note: The dates and times displayed in the response are in the same time zone as the system. You may check your system's time zone in the Sending step of a Campaign in Campaign Suite.
HTTP Status Code | Description |
200 | OK - everything worked as expected. Example Response Body {
|
401 | The Access Token obtained has expired, or is invalid. Call the Authenticate API again to obtain a new Access Token. Example Response Body { |
How to know the Data Set for your system?
- Kindly Log into your CustomerGauge Platform. You will need Admin Access.
- Navigate to Data → REST APIs → API Playground and select the API of your choice. Configure the parameters as desired, and press 'Send Request'
- If you would like to get the data with additional Parameters (such as Questions, Drivers, Tags and Properties), This is described in the with[] section under the Request portion in the documentation. Example API for the GET Responses with parameters: https://api.eu.customergauge.com/v7/rest/sync/responses?per_page=1000&with[]=properties&with[]=selected_drivers&with[]=tags&with[]=questions
- Statuses available - `response` or `partial-response`
Examples
cURL example
curl --location --request GET 'https://api.{{ apiRegion }}.customergauge.com/v7/rest/sync/responses' \
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
Not the API you're looking for?
Get an overview of our APIs here.