Skip to main content

Overview

The Activity API is called with identifiers for a respondent and a time range in hours. This guide shows how to send the request with POST, passing the parameters as a JSON body. All parameters are optional. Unlike the search and review APIs, the Activity API runs on resdefio.com and is authorized with an authorization key that you send in the x-api-key header.

Authentication

Send your authorization key in the x-api-key header of every request.
string
required
Your Research Defender authorization key.
Your authorization key is a secret. The sample on this page calls the API from the browser for demonstration, but anything in client-side code can be read. If you can, call the Activity API from your server and keep the key there.

Endpoint

string
POST https://{environment}.resdefio.com/activity
In the sample, set ENVIRONMENT to "prod" or "stage".

Request body

Send the parameters as a JSON object. All parameters are optional.
string
The survey number. Optional.
string
The respondent’s session ID. Optional.
string
The panel ID. Optional.
string
The respondent’s hashed email address. Optional.
number
default:"24"
The time range in hours. Optional. If you leave it out, 24 is used.

Range values

Range accepts one of these values, in hours.

Sending more parameters

The sample sends Survey_Number and Session_Id. To send Panel_Id, Hashed_Email, or Range, add them to the object in buildPayload(). A request body with every parameter looks like this:

Example

activity-post.js
The JavaScript example builds the body with buildPayload(), which leaves out empty values. getActivity() sends the request with the Content-Type and x-api-key headers and shows the API’s message if the request fails.

Full HTML page

If you want a complete page you can open in a browser, use the sample below. Replace the placeholder values at the top of the script.
activity-post-integration.html

Troubleshooting