Update consent
1 min
POST
https://api.us1.odp.optimizely.com/v3/consent
Body Parameters
- bodyConsentUpdateRequest[]requiredExamplesUpdate consent request:
[ { "identifier_value": "[email protected]", "identifier_field_name": "email", "consent": true, "consent_update_reason": "reason", "consent_update_ts": "ts" }, { "identifier_value": "email", "identifier_field_name": "[email protected]", "consent": false, "consent_update_reason": "reason", "consent_update_ts": "ts" } ]- identifier_field_namestringrequiredExampleDescription
- identifier_valuestringrequiredExampleDescription
- consentbooleanrequiredExampleDescription
- consent_update_reasonstringDescription
- consent_update_tsinteger<int64>DescriptionFormatint64
- event_datamap<string, object>Description
Responses
202
- GenericUpdateResponse
- titlestring
- statusinteger<int32>Formatint32
- timestampstring
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 POST \
--url https://api.us1.odp.optimizely.com/v3/consent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data-raw '[
{
"identifier_field_name": "email",
"identifier_value": "[email protected]",
"consent": true
}
]'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify([
{
"identifier_field_name": "email",
"identifier_value": "[email protected]",
"consent": true
}
]);
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.us1.odp.optimizely.com/v3/consent", 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")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump([
{
"identifier_field_name": "email",
"identifier_value": "[email protected]",
"consent": true
}
])
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.us1.odp.optimizely.com/v3/consent"
payload = json.dumps([
{
"identifier_field_name": "email",
"identifier_value": "[email protected]",
"consent": True
}
])
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
202
// Consent updated successfully
{
"title": "",
"status": "",
"timestamp": ""
}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\"}}"