Overview
This guide shows how to call the Research Defender respondent search endpoint from client-side JavaScript. You can use either aGET or a POST request. Both return the same result.
After the request completes, you can read:
Prerequisites
- A Research Defender publishable key
- Your survey number (
sy_nr) - The respondent’s session ID (
sn_ud)
Endpoint
string
required
The Research Defender environment, for example
prod.string
required
Your Research Defender publishable key.
Request parameters
string
required
The survey number.
string
required
The respondent’s session ID.
Requests must be sent with credentials (
credentials: "include") so Research Defender cookies are included.Examples
- POST
- GET
post-search.js
Full HTML pages
If you want a complete page you can open in a browser, use one of the samples below. Replace the placeholder values at the top of the script before running.Basic POST integration (HTML)
Basic POST integration (HTML)
basic-post-integration.html
Basic GET integration (HTML)
Basic GET integration (HTML)
basic-get-integration.html
Handling errors
A non-200 status means the lookup did not succeed. The samples throw an error in that case so you can decide how to handle it, for example by letting the respondent continue or logging the failure.
