Registering panelists
Pureprofile APIs allows the registration of new panelists to specific panels. So any panel you have access to can be used to register new panelists. Each panelist is unique and can exist in a single panel only.
Register a panelist
In order to register a new panelist you must provide a unique id (email, uuid, etc) that can be used to identify the panelist. You must also provide the following fields:
- panel the user belongs to
- first name
- last name
- locale of user
- date of birth
The locale is required since each panel can contain more than one locale. So we could have a Belgium panel with a Dutch and
a French locale. So you must select a specific locale during registration. In order to get available panels with their locales you
can use the partner/panels/list
endpoint.
Below is a sample for registering a new panelist:
- cURL
- Node
- Python
- Go
curl --location --request POST 'https://api.sandbox.pureprofile.io/v1/partner/panel/register' \--header 'Content-Type: application/json' \--header 'Accept: application/json' \--header 'Authorization: Basic <credentials>' \--data-raw '{ "user": "<user id|email>", "panel": "<panel guid>", "locale": "<locale>", "dob": "<date iso>", "first_name": "<firstname>", "last_name": "<lastname>"}'
var request = require("request");var options = { method: "POST", url: "https://api.sandbox.pureprofile.io/v1/partner/panel/register", headers: { "Content-Type": "application/json", Accept: "application/json", Authorization: "Basic <credentials>", }, body: JSON.stringify({ user: "<user id|email>", panel: "<panel>", locale: "<locale>", dob: "<date iso>", first_name: "<firstname>", last_name: "<lastname>", }),};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);});
import requestsimport jsonurl = "https://api.sandbox.pureprofile.io/v1/partner/panel/register"payload = json.dumps({ "user": "<user id|email>", "panel": "<panel>", "locale": "<locale>", "dob": "<date iso>", "first_name": "<firstname>", "last_name": "<lastname>"})headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Basic <credentials>'}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
package mainimport ( "fmt" "strings" "net/http" "io/ioutil")func main() { url := "https://api.sandbox.pureprofile.io/v1/partner/panel/register" method := "POST" payload := strings.NewReader(`{ "user": "<user id|email>", "panel": "<panel>", "locale": "<locale>", "dob": "<date iso>", "first_name": "<firstname>", "last_name": "<lastname>" }`) client := &http.Client {} req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Basic <credentials>") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body))}
The response of this API contains the user_id
of the registered user with an access_token
that can be used to access
all Panel API endpoints:
{ "message": "success", "data": { "user_id": "<user id>", "token": { "token_type": "Bearer", "expires_in": 2592000, "access_token": "<access_token>" } }}