Get consent
1 min
GET
https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}
Path Parameters
- identifier_field_namestringrequiredExampleDescription
Query Parameters
- idstringrequiredExampleDescription
Responses
200
- ConsentGetResponse
- identifier_field_namestringrequiredExampleDescription
- identifier_valuestringrequiredExampleDescription
- consentbooleanrequiredExampleDescription
- consent_update_reasonstringDescription
- consent_update_tsinteger<int64>DescriptionFormatint64
- zaius_idinteger<int64>DescriptionFormatint64
400
- undefinedExample
{ "title": "Bad Request", "status": 400, "timestamp": "2018-09-10T21:07:10-05:00", "detail": { "invalids": [ { "field": "delimiter", "reason": "Unrecognized delimiter, valid options are comma, tab or pipe" } ] } }
403
- undefinedExample
{ "message": "Forbidden" }
404
- undefinedExample
{ "title": "Bad Request", "status": 404, "timestamp": "2018-09-10T21:07:10-05:00", "detail": { "message": "Not found description" } }
curl
curl --request GET \
--url 'https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}?id=example%40example.com' \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}[email protected]", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}[email protected]")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.us1.odp.optimizely.com/v3/consent/{identifier_field_name}[email protected]"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// Consent information found
{
"identifier_field_name": "email",
"identifier_value": "[email protected]",
"consent": true,
"consent_update_reason": "",
"consent_update_ts": "",
"zaius_id": ""
}400
// Bad Request
"{\"title\":\"Bad Request\",\"status\":400,\"timestamp\":\"2018-09-10T21:07:10-05:00\",\"detail\":{\"invalids\":[{\"field\":\"delimiter\",\"reason\":\"Unrecognized delimiter, valid options are comma, tab or pipe\"}]}}"403
// Forbidden
"{ \"message\": \"Forbidden\"}"404
// Not Found
"{\"title\":\"Bad Request\",\"status\":404,\"timestamp\":\"2018-09-10T21:07:10-05:00\",\"detail\":{\"message\":\"Not found description\"}}"