Profiles
For each panelist Pureprofile allows the collection and management of profiling variables. Profiling variables are associated with questions and are used for defining targets and quotas. Pureprofile Sampling API uses the profile variables collected to match panelists to surveys. Different endpoints are used for profiles:
- View available profile variables
- View panelists profile variables
- Update a profile variable
- Delete a profile variable
View available profile variables
An example for getting retrieving all available Panel profile variables:
- cURL
- Node
- Python
- Go
curl --location --request GET 'https://api.sandbox.pureprofile.io/v1/panel/variables/meta' \--header 'Accept: application/json' \--header 'Authorization: Bearer <access_token>'
var axios = require("axios");var config = { method: "get", url: "https://api.sandbox.pureprofile.io/v1/panel/variables/meta", headers: { Accept: "application/json", Authorization: "Bearer <access_token>", },};axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
import requestsurl = "https://api.sandbox.pureprofile.io/v1/panel/variables/meta"payload={}headers = { 'Accept': 'application/json', 'Authorization': 'Bearer <access_token>'}response = requests.request("GET", url, headers=headers, data=payload)print(response.text)
package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://api.sandbox.pureprofile.io/v1/panel/variables/meta" method := "GET" client := &http.Client {} req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer <access_token>") 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 contains information regarding the account of the panelist:
{ "message": "success", "data": [ { "id": 31, "name": "ADDRESS", "text": "ADDRESS", "uuid": "3YRMHU5DyUcnwLq8WELr51", "type": "text", "writable": true, "options": [] }, { "id": 29, "name": "BIRTH_DATE", "text": "When is your birthday?", "uuid": "1lbJlPvf566FGkQ6tM1l4s", "type": "date", "writable": true, "options": [] }, { "id": 71, "name": "BUSINESS_DECISION_PRODUCTS", "text": "BUSINESS_DECISION_PRODUCTS", "uuid": "5ZI4zHtGuVZc0HsaYlHGn5", "type": "checkbox", "writable": false, "options": [ { "id": 1, "name": "Banking and financial products", "text": "Banking and financial products", "exclusive": false }, { "id": 2, "name": "Catering", "text": "Catering", "exclusive": false }, { "id": 3, "name": "Cleaning", "text": "Cleaning", "exclusive": false }, ... ] }, ...}
Fetch panelist profile variables
To get all profile variables stored for a panelist you can use the endpoint below. There is also a filter that can be applied to retrieve only the writable data variables for a panelist:
- cURL
- Node
- Python
- Go
curl --location --request GET 'https://api.sandbox.pureprofile.io/v1/panel/variables/data?filter=writable' \--header 'Accept: application/json' \--header 'Authorization: Bearer <access_token>'
var axios = require("axios");var config = { method: "get", url: "https://api.sandbox.pureprofile.io/v1/panel/variables/data?filter=writable", headers: { Accept: "application/json", Authorization: "Bearer <access_token>", },};axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
import requestsurl = "https://api.sandbox.pureprofile.io/v1/panel/variables/data?filter=writable"payload={}headers = { 'Accept': 'application/json', 'Authorization': 'Bearer <access_token>'}response = requests.request("GET", url, headers=headers, data=payload)print(response.text)
package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://api.sandbox.pureprofile.io/v1/panel/variables/data?filter=writable" method := "GET" client := &http.Client {} req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer <access_token>") 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 contains information regarding the account of the panelist:
{ "message": "success"}
Updating panelist profile variables
To update a profile variable for a panelist you must use the endpoint below. Profiling variables that can be updated
are the ones that have the writable: true
field in the list of variables returned above:
- cURL
- Node
- Python
- Go
curl --location --request POST 'https://api.sandbox.pureprofile.io/v1/panel/variables/data' \--header 'Content-Type: application/json' \--header 'Accept: application/json' \--header 'Authorization: Bearer <access_token>' \--data-raw '{ "CAR": 1, "CAREER_DECISION_MAKER": 2}'
var axios = require("axios");var data = JSON.stringify({ CAR: 1, CAREER_DECISION_MAKER: 2,});var config = { method: "post", url: "https://api.sandbox.pureprofile.io/v1/panel/variables/data", headers: { "Content-Type": "application/json", Accept: "application/json", Authorization: "Bearer <access_token>", }, data: data,};axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
import requestsimport jsonurl = "https://api.sandbox.pureprofile.io/v1/panel/variables/data"payload = json.dumps({ "CAR": 1, "CAREER_DECISION_MAKER": 2})headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer <access_token>'}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/panel/variables/data" method := "POST" payload := strings.NewReader(`{ "CAR": 1, "CAREER_DECISION_MAKER": 2 }`) 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", "Bearer <access_token>") 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))}
If the profile variables are updated the system will return a success message:
{ "message": "success"}
Deleting panelist profiling variables
To delete a profile variable you must use the endpoint below:
- cURL
- Node
- Python
- Go
curl --location --request DELETE 'https://api.sandbox.pureprofile.io/v1/panel/variables/data/:var_name' \--header 'Content-Type: application/json' \--header 'Accept: application/json' \--header 'Authorization: Bearer <access_token>'
var axios = require("axios");var config = { method: "delete", url: "https://api.sandbox.pureprofile.io/v1/panel/variables/data/:var_name", headers: { "Content-Type": "application/json", Accept: "application/json", Authorization: "Bearer <access_token>", },};axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
import requestsimport jsonurl = "https://api.sandbox.pureprofile.io/v1/panel/variables/data/:var_name"headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer <Access_token>'}response = requests.request("DELETE", url, headers=headers)print(response.text)
package mainimport ( "fmt" "strings" "net/http" "io/ioutil")func main() { url := "https://api.sandbox.pureprofile.io/v1/panel/variables/data/:var_name" method := "DELETE" client := &http.Client {} req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer <access_token>") 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))}
If the profile variables is deleted the system will return a success message:
{ "message": "success"}