CheckMarket Survey API Documentation
CheckMarket Survey API Documentation
Ver. 2.0.9
API
Documentation
TABLE OF CONTENTS
INTRODUCTION.................................................................................................. 4 1 1.1 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 RESTFUL API ........................................................................................ 5 Introduction ......................................................................................... 5 Terminology ......................................................................................... 5 Resource .............................................................................................. 5 Resource identifier ................................................................................. 5 Attribute ............................................................................................... 5 Overview .............................................................................................. 5 HTTP-request requirements ..................................................................... 5
Response and Status Codes ..................................................................... 7 Error messages ...................................................................................... 8 List of Status Codes................................................................................ 8 JSONP .................................................................................................. 8 Functions ............................................................................................. 9 Panels .................................................................................................. 9
Surveys .............................................................................................. 10 Respondent filter.................................................................................. 10 Scenarios ........................................................................................... 12 Adding Panelists to panels ..................................................................... 12 Adding a Folder to panels ...................................................................... 16
Case 1: Adding multiple panelists, success ............................................................................ 12 Case 2: Adding multiple panelists, error ................................................................................ 15 Case 1: Adding a folder, success .......................................................................................... 16 Case 2: Adding a folder, error ............................................................................................. 16 Case 3: Updating attributes of a folder ................................................................................. 17
1.5.3
Case 1: Adding a panel, success .......................................................................................... 17 Case 2: Adding a panel, error .............................................................................................. 18 Case 3: Updating attributes of a panel .................................................................................. 18
SOAP API ........................................................................................... 19 Introduction ....................................................................................... 19 Authentication ................................................................................... 19 Functions ........................................................................................... 19 Panelists ............................................................................................. 19 Panels ................................................................................................ 20 Folders ............................................................................................... 20 Surveys .............................................................................................. 21
3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14
ENTITIES ........................................................................................... 22 Panelist .............................................................................................. ImportOptions ................................................................................... Folder ................................................................................................ Panel .................................................................................................. Survey................................................................................................ Report ................................................................................................ SuccessReport ................................................................................... FailedReport ...................................................................................... PanelistReport ................................................................................... Participant ......................................................................................... Respondent ........................................................................................ Question ............................................................................................ Response ........................................................................................... Language ........................................................................................... 22 23 24 25 25 26 27 27 28 28 29 30 31 31
INTRODUCTION
CheckMarket's application programming interface (API) allows developers to hook into CheckMarket and integrate its functionality into internal applications. You can integrate CheckMarket data gathering technology with your: CRM HR ERP Call Center Customer Service
or other key systems to analyze and compare all kinds of information including customer, employee, partner, and member attitudinal data. CheckMarket's new API enables users to: Automatically send surveys after each pre-defined event, such as a sale or customer service contact. Create relevant survey questions based on the individual customer's profile stored in your company's database. Integrate historical customer survey responses into the company's CRM.
To make integration even easier, the CheckMarket API SOAP interface supports a growing number of languages including Java, .NET, PHP and Ruby. In addition, SOAP request/response messages enable users to identify errors on-the-fly without sending requests to CheckMarket's support team. Moreover, CheckMarket has a dedicated team of developers with extensive experience integrating CheckMarket software with all kinds of enterprise applications.
1
1.1
RESTFUL API
Introduction
Communication with CheckMarkets RESTful API happens via simple HTTP requests to https://api.checkmarket.com. CheckMarkets RESTful API adheres to the principles of REST architecture. More information about this architecture can be found here.
1.2
Terminology
This section describes the basic terminology within the RESTful context. 1.2.1 Resource
A resource is the RESTful representation of an entity within CheckMarkets system. A panelist or a folder in panels are examples of resources. Resources can be accessed via a URI. An example URI to retrieve a collection of resources could look like this: api.checkmarket.com/{resource}. Every resource has got a resource identifier. This is how a single resource can be accessed. The resource identifier is appended to the end of the URI of a specific resource. Example: api.checkmarket.com/{resource}/{id}. id represents the Id attribute of a specific resource. 1.2.2 Resource identifier
1.3
1.3.1
Overview
HTTP-request requirements
To access a resource 4 things are needed: URI; Format (data-interchange format); Method (action); API key (authenticatication) URI
1.3.1.1
The most complete Unique Resource Identifier looks like this: https://api-{region}.checkmarket.com/{version}/{resource}/{id} The URI contains of four parts.
{region} sets your endpoint to the correct data region. You can find your endpoint in your account under API; {version} targets a specific version of the API; {resource} defines a resource; {id} is the resource identifier (the Id attribute of a resource)
Example 1: A panelist with Id 620: https//api-us.checkmarket.com/2/panelist/620 The version number can be left out. This way youll be communicating with the latest version of the API. Note that targeting a specific version of the API is recommended to avoid breaking changes. CheckMarkets RESTful API supports XML and JSON as data-interchange format. Data can be retrieved and accessed in both formats. The format is specified in the ContentType HTTP header. Valid HTTP headers: Content-Type: application/xml Content-Type: application/json Authentication
1.3.1.2
Authentication happens via a unique key, the API key, which is connected to your account. The API key can be found in the member section under my account. The key should be passed along with every request under the X-CheckMarket-Key HTTP header. Example: X-CheckMarket-Key: 5x4f6z84fz67z9z45p 1.3.1.3 Method
The HTTP method will reflect the action on a resource. Supported HTTP methods are: GET to retrieve a resource POST to create a resource PUT to update a resource DELETE to delete a resource
These methods are often respectively associated with the READ, CREATE, UPDATE, DELETE operations associated with database technologies. Example GET 1: Retrieve a collection of resources: GET /{resource} Example: GET /panels/877/panelists Example GET 2: Retrieve a specific resource: GET /{resource}/{id} Example: GET /panels/panelist/620 Example POST: Creating a resource: POST /{resource} Example: adding a folder to panels Request: Method POST /panels/folder
Headers Body
Example PUT:
Updating a resource: PUT /{resource}/{id} Example: updating the Description attribute of a folder in panels Method Headers Body PUT /panels/folder/857 Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Folder> <Description>Better description</Description> </Folder>
Example DELETE:
Deleting a resource: DELETE /{resource}/{id} Example: deleting folder 857 Method Headers DELETE /panels/folder/857 X-CheckMarket-Key: 5x4f6z84fz67z9z45p
1.3.2
Every request will be answered with a proper response and status code. If, for example, a resource has been successfully created, status code 200 (OK) will be returned together with the Id of the newly created resource. Example: adding a folder to panels Request: Method Headers Body POST /panels/folders Content-Type: application/json X-CheckMarket-Key: 5x4f6z84fz67z9z45p
{"Name":"Folder 1","Description":"Some classification"}
200
857
1.3.3
Error messages
CheckMarkets RESTful API returns error messages in your requested format. An error message consist of two attributes: Message: contains error-related info; Request: the request URI
An example error message in XML could look like this: <Error> <Message>Panelist with id 12345 does not exist.</Message> <Request>/panels/panelists/12345</Request> </Error> 1.3.4 Code 200 400 401 404 500 List of Status Codes Name OK Bad Request Unauthorized Not Found Internal Server Error Description Successful request, correct data will be returned. The request contains a bad syntax and failed. Authorization failed. The Api key supplied isnt valid or couldnt be found (no X-CheckMarket-Key header). The requested resource couldnt be found. Something went wrong on our side. Contact our helpdesk.
1.3.5
JSONP
Callback support is currently implemented via JSON with Padding. This way the JSON encoded content will be wrapped in a function call specified via the callback query parameter that should be appended to the query string as follows: Request: Method Headers GET /panels/folders/0?callback=myFunction Content-Type: application/json X-CheckMarket-Key: 5x4f6z84fz67z9z45p
200
myFunction( [{"Id":946,"Name":"Categorie X","Description":"","PanelCount":2,"PanelistCount":4}] );
1.4
Functions
This section gives an overview of the available functions. Please refer to the Scenarios section for detailed information. The available attributes can be found in the entities section. 1.4.1 1.4.1.1 Method GET GET POST PUT DELETE Panels panels/Folders Resource panels/folder/{id}/folders panels/folder/{id} panels/folder panels/folder/{id} panels/folder/{id} Information Get folders in a folder. 0 = root Gets a folder. Adds a folder to the panel. Updates the attributes of a folder. Deletes a folder. (recursively)
panels/Panels Resource panels/folder/{id}/panels panels/panel/{id} panels/panel panels/panel/{id} panels/panel/{id} Information Get panels in a folder. 0 = root Get attributes of a panel. Adds a panel. Updates the attributes of a panel. Deletes a panel. (Panelists that dont exist in another will be deleted.)
panels/Panelists Resource panels/panelist/{id} panels/{id}/panelists panels/panelists Information Gets a panelist. Get panelists in a panel. Adds one or more panelists.
10
DELETE
panels/panelist/{id}
Deletes a panelist.
Surveys Resource surveys?l={language} Information Returns a list of surveys, see languages list. Returns a single survey. Gets panelists in the survey. Gets respondents with optional filter. Get question overview. Returns the average Returns the median Returns the mean
survey/{survey_id}/?={language} survey/{survey_id}/panelists survey/{survey_id}/respondents?{FilterName}={Value} see table Respondent filter survey/{survey_id}/questions?l={language} survey/{survey_id}/question/{question_id}/avg survey/{survey_id}/question/{question_id}/med survey/{survey_id}/question/{question_id}/mean Respondent filter Information
Fieldname StartResponseDate
Only include respondents who answered on or after this date. Use the format YYYY-MM-DD hh:mm Only include respondents who answered before this date. Use the format YYYY-MM-DD hh:mm Gets respondents with a certain e-mailaddress Gets respondents with a certain value in one of the optional fields. Get respondents with a certain end status: 0 = partially responded 1 = completely responded
EndResponseDate
11
limit offset
12
1.5
1.5.1
Scenarios
Adding Panelists to panels
Its a good idea to get a grasp on the structure of panels before diving into different scenarios. Panels consists of 3 entities that are hierarchically related to each other: Panelist, Panel, Folder.
Folder Id ParentFolderId
3 2
Coupling occurs via attributes as shown in the diagram. 1) A panelist MUST be added to a Panel. I.e. the PanelId attribute should reference an existing Panel Id. This means that a Panel should be present or that a Panel should be created before adding a Panelist. 2) Panels can be nested into Folders via the FolderId of a Panel. The FolderId attribute should reference an existing Folder Id. 3) Folders can be nested into Folders via the ParentFolderId attribute. ParentFolderId should reference an existing Folder Id. Note: FolderId and ParentFolderId can be empty. If so, the Panel or Folder will be added to the root of panels. 1.5.1.1 Case 1: Adding multiple panelists, success
Adding multiple panelists requires the ImportOptions and the Panels panel-entity to be grouped together in the AddPanelists root element. Request: Method Headers POST /panels/panelists Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
13
Body
<AddPanelists> <ImportOptions> <PanelId>8222</PanelId> <SurveyId>1234</SurveyId> <DefaultLanguage>nl</DefaultLanguage> </ImportOptions> <Panelists> <Panelist> <FirstName>John</FirstName> <LastName>Doe</LastName> <Email>[email protected]</Email> </Panelist> <Panelist> <FirstName>Jane</FirstName> <LastName>Doe</LastName> <Email>[email protected]</Email> </Panelist> <Panelist> <FirstName>Hugo</FirstName> <LastName>Leysen</LastName> <Email>[email protected]</Email> </Panelist> <Panelist> <FirstName>Jan</FirstName> <LastName>Smith</LastName> <Email>jan@xyz</Email> </Panelist> </Panelists> </AddPanelists>
14
Response: On success a detailed report will be returned. The report returns the Ids of the successfully added panelists in the Success element. The Failed element contains a PanelistReport list which details what went wrong. Both elements display the number of added/failed panelists in the Amount element. Status Code Body 200 (Ok) <Report> <Success> <Amount>2</Amount> <IdList> <int>90688</int> <int>90689</int> </IdList> </Success> <Failed> <Amount>2</Amount> <FailedList> <PanelistReport> <Attribute>Email</Attribute> <ErrorMessage>A panelist with the supplied Email already exists.</ErrorMessage> <Panelist> <FirstName>Hugo</FirstName> <LastName>Leysen</LastName> <Email>[email protected]</Email> </Panelist> </PanelistReport> <PanelistReport> <Attribute>Email</Attribute> <ErrorMessage>The Email attribute is not valid.</ErrorMessage> <Panelist> <FirstName>Jan</FirstName> <LastName>Smith</LastName> <Email>jan@xyz</Email> </Panelist> </PanelistReport> </FailedList> </Failed> </Report>
15
1.5.1.2 Request:
Assuming the supplied SurveyId exists but doesnt have the correct status. Method Headers Body POST /panels/panelists Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p <AddPanelists> <ImportOptions> <PanelId>8222</PanelId> <SurveyId>54321</SurveyId> <EmailRequired>true</EmailRequired> <DefaultLanguage>nl</DefaultLanguage> </ImportOptions> <Panelists> <Panelist> <FirstName>John</FirstName> <LastName>Doe</LastName> </Panelist> <Panelist> <FirstName>Jan</FirstName> <LastName>Smith</LastName> </Panelist> </Panelists> </AddPanelists>
Response: The supplied SurveyId hasnt got the correct status assigned. A descriptive error message will be returned. Status Code Body 404 (Bad Request) <Error> <Message> Survey with SurveyId '54321' should have "In development" or "Live" status.</Message> <Request>/panelists</Request> </Error>
16
1.5.2
A folder is the highest entity in the panels hierarchy. Folders are used to either subdivide Panels to create a logical structure or to nest Folders. 1.5.2.1 Request: Method Headers Body POST /panels/folder Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Folder> <Name>Folder 1</Name> <Description>Some classification</Description> </Folder>
Response: On success the Id of the folder will be returned. Status Code Body 200 (Ok) <int>857</int>
Refer to the Entities section for an overview of the available attributes. 1.5.2.2 Request: Well supply a ParentFolderId that doesnt exist. Method Headers Body POST /panels/folder Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Folder> <Name>Folder 2</Name> <Description>Some classification</Description>
<ParentFolderId>12345</ParentFolderId>
</Folder>
Response: An appropriate error message will be returned. Status Code Body 404 (Bad Request) <Error> <Message>The Parent '12345' does not exist.<Message> <Request>/folders</Request>
17
</Error> Refer to the Entities section for an overview of the available attributes. 1.5.2.3 Request: We want to nest a folder by updating its ParentFolderId. Method Headers Body PUT /panels/folder/857 Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Folder>
<ParentFolderId>4657</ParentFolderId>
</Folder>
Response: On success the appropriate status code is returned. Status Code 200 (Ok)
Refer to the Entities section for an overview of the available attributes. 1.5.3 Adding a Panel to panels
Panels are used to structure multiple panelists. 1.5.3.1 Request: Method Headers Body POST /panels/panel Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Panel> <Name>Customers</Name> <Description>Customer panel</Description> </Panel>
Response: On success the Id of the Panel will be returned. Status Code Body 200 (Ok) <int>256</int>
18
1.5.3.2 Request:
Well supply a panel name that already exists. Method Headers Body POST /panels/panel Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Panel> <Name>Customers</Name> <Description>Some panel</Description> </Panel>
Response: An appropriate error message will be returned. Status Code Body 404 (Bad Request) <Error> <Message>A panel with name 'Customers' already exists.<Message> <Request>/panels</Request> </Error>
Refer to the Entities section for an overview of the available attributes. 1.5.3.3 Request: We want to nest a folder by updating its ParentFolderId. Method Headers Body PUT /panels/panel/256 Content-Type: application/xml X-CheckMarket-Key: 5x4f6z84fz67z9z45p
<Panel>
<FolderId>857</FolderId>
</Panel>
Response: On success the appropriate status code is returned. Status Code 200 (Ok)
19
2
2.1
SOAP API
Introduction
This documentation assumes that you are familiar with SOAP and web services. Communication with CheckMarkets SOAP API can be easily established via the WSDL file. The SOAP library in your preferred programming language will auto-generate the operations, data types, etc. The WSDL file can be obtained via URL: https://api.checkmarket.com?wsdl Some clients fail to include the correct SOAP endpoint in the WSDL file, please do change the address manually to https://api.checkmarket.com/SurveyService.svc/soap
2.2
Authentication
Authentication happens via a unique key, the API key, which is connected to your account. The API key can be found in the member section under my account. Every SOAP call requires the API key to be supplied within a SOAP header named CheckMarket-Key under the namespace api.checkmarket.com.
2.3
Functions
Note that all functions will return valuable error information via exceptions. Please do use exception handling in your programming language to catch error messages. 2.3.1 Function GetPanelist GetPanelistsInPanel AddPanelist Panelists Parameters id (string) id (string) ImportOptions (ImportOptions), Panelist (Panelist) ImportOptions (ImportOptions), Panelists (Panelists[]) id (string) Return type Panelist Panelist[] Integer (32 bit) Information Gets the panelist with the specified id. Returns a list of panelists for the given Panel id. Add a single panelist to the panel.
AddPanelists
Report
DeletePanelist
Boolean
20
Panels Parameters id (string) id (string) panel (Panel) id (string), panel (Panel) id (string) Return type Panel[] Panel Integer (32 bit) Boolean Boolean Information Returns the list of panels in the given folder id. Gets the panel with the specified id. Adds a panel to panels. Updates the attributes of the specified panel. Deletes the panel with the specified id. (recursively)
UpdatePanel DeletePanel
2.3.3 Function
Folders Parameters id (string) id (string) folder (Folder) id (string), folder (Folder) id (string) Return type Folder[] Folder Integer (32 bit) Boolean Boolean Information Returns the list of folders in the given folder id. Gets the folder with the specified id. Adds a folder to panels. Updates the attributes of the specified folder. Deletes the folder with the specified id. (recursively)
21
2.3.4 Function
Surveys Parameters language (string) language (string) Id (string) id (string), filters (Filter[]) id (string), language (language) Return type Survey[] Survey Participant[] Respondent[] Information Returns list of surveys in account. Returns the attributes of the specified survey id. Returns participants of the survey. Returns a list of respondents.
GetQuestions
Question[]
22
3
3.1
ENTITIES
Panelist
Panelist in the panel Resource: Serialized name: XML collection: Attributes: panelist and panelists Panelist ArrayOfPanelist Name Id FirstName LastName Email LanguageCode Optional1 Optional2 Optional3 Optional4 Optional5 Street HouseNumber Suite PostalCode City State Province CountryId Type Integer String String String String String String String String String String String String String String String String String Required N/A No No No No No No No No No No No No No No No No No Information Identifier Given name Family name Email address ISO Lang Code Optional field Optional field Optional field Optional field Optional field Street House number Suite Postal code City State Province ISO Country Code Phone number M or F
Phone Gender
String String
No No
23
DateOfBirth DateToBeMailed
String String
No No
DateToExpire
String
No
Panels
No
3.2
ImportOptions
Entity used when adding a single panelist or multiple panelists. Resource: Serialized: XML collection: Attributes: / ImportOptions ArrayOfImportOptions Name PanelId Type Integer (32 bit) Required Yes Info Used when adding panelists When supplied the panelist will be added to the panel of the given survey. true or false, default value is true true or false, default value is true Language code specified from available languages.
SurveyId
No
EmailRequired
Boolean
No
EmailUniqueInPanel
Boolean
No
DefaultLanguage
String
No
24
3.3
Folder
Folders are used to subdivide panels. Resource: Serialized name: XML collection: Attributes: folder and folders Folder ArrayOfFolder Name Id Type Integer (16 bit) String Required N/A Info Identifier
Name
Yes
Name to be shown in the panel Optional information to be supplied Used to nest folders in one another. Number of folders in folder and in nested folders. Number of panels in folder and in nested folders. Number if panelists in folder and in nested folders.
Description
String
No
ParentFolderId
No
FolderCount
N/A
PanelCount
N/A
PanelistCount
N/A
25
3.4
Panel
Panels are used to subdivide panelists in the panel. Resource: Serialized name: XML collection: Attributes: panel and panels Panel ArrayOfPanel Name Id Type Integer (32 bit) String Required N/A Info Identifier
Name
Yes
Name to be shown in the panel Optional information to be supplied Used to nest a panel into a folder Number of panelists in panel
Description
String
No
FolderId
No
PanelistCount
N/A
3.5
Survey
Representation of a survey Resource: Serialized name: XML collection: Attributes: surveys Survey ArrayOfSurvey Name Id Type Integer (32 bit) Title Integer (8bit) String Required N/A Info Identifier
Title StatusId
N/A N/A
Title of survey
StatusString
N/A
CreationDate
String
N/A
26
StartDate
String
N/A
Yyyy-mm-dd hh:mm:ss Yyyy-mm-dd hh:mm:ss Yyyy-mm-dd hh:mm:ss Yyyy-mm-dd hh:mm:ss Indicates if survey is a free trial survey Name of user that created survey Number of panelists in panel Number of respondents URL of preview version List of the available languages
EndDate
String
N/A
TargetArchiveDate
String
N/A
ArchiveDate
String
N/A
IsTrial
Boolean
N/A
CreatedBy
String
N/A
PanelistCount
Integer (32-bit)
N/A
RespondentCount
N/A
PreviewURL
N/A
Languages
Language[]
N/A
3.6
Report
Return value when adding multiple panelists Resource: Serialized name: XML collection: Attributes: / Report / Name Success Failed Type SuccessReport FailedReport Required N/A N/A Info Success report Failed report
27
3.7
Resource:
SuccessReport
/ Success / Name Amount Type Integer (32 bit) Integer Required N/A Info Amount of successfully added panelists Ids of added panelists
IdList
N/A
3.8
FailedReport
/ Failed / Name Amount Type Integer (32 bit) PanelistReport list Required N/A Info Amount of panelists that were not added PanelistReports of panelists that were not added
FailedList
N/A
28
3.9
PanelistReport
/ PanelistReport FailedList Name Attribute Type String Required N/A Info The attribute that caused the error Description of what went wrong Panelist object
ErrorMessage
Title
N/A
Panelist
Panelist
N/A
3.10
Participant
inherits members of Panelist DateAdded DateClickedThrough DateInvited DateReminded DateRemindedPartial DateSawMail DateSecondReminder DateSentThankYouMail ResponseDate string string string string string string string string string no no no no no no no no no
29
Status
String
N/A
1= Included 2= Invited 3= Reminded 4= Partially responded 5= Responded completely 6= Dropped 7= Declined 9= Bounced 13 = Screened out
3.11
Respondent
inherits members of Panelist inherits members of Participant RespondentId Browser CompletionTime Integer String String N/A No No Time (in seconds) needed to Identifier
30
complete the survey DistributionMethodId String No Type of distribution End status of the respondent
EndStatusId
String
No
IpAddress OS
String String
Questions
String
No
ReportURL
String
N/A
3.12
Question
Questions in a survey. Resource: Serialized name: XML collection: Attributes: question and questions Question ArrayOfQuestion Name Id Type Integer (32 bit) String String Required N/A Info Identifier
DataLabel Responses
Yes No
DataLabel Responses for the given question Language String value Number of panelists in panel QuestionTypeId
No No N/A
QuestionTypeId
N/A
31
PageNumber OrderNumber
Integer Integer
No No
Number of the page Order of the question within the page or within the parent question Visible number of the question
QuestionNumber
Integer
No
3.13
Response
Response to a question. Resource: Serialized name: XML collection: Attributes: response and responses Response ArrayOfResponse Name Id OpenText Type Integer (32 bit) String Required N/A N/A Info Identifier Open text value String value
Value
string
32
3.14
Language
Available language for surveys Resource: Serialized name: XML collection: Attributes: survey Language Languages Name IsoCode Name Type String String Required N/A N/A Info Identifier Name of the language Defines the default language
IsDefault
Bool
N/A