Update a Custom Event
1 min
PATCH
https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}
Path Parameters
- project_idinteger<int64>requiredDescriptionFormatint64
- event_idinteger<int64>requiredDescriptionFormatint64
Body Parameters
- bodyCustomEventUpdaterequiredDescription
- archivedbooleanDescription
- categoryEventCategories
- namestring
- descriptionstringDescription
- keystringExampleDescriptionMax Length64Pattern^[a-zA-Z0-9_\- .]+$
- namestringExampleDescription
Responses
200
- CustomEvent
- archivedbooleanDescription
- categoryEventCategories
- namestring
- createdstring<date-time>DescriptionFormatdate-time
- descriptionstringDescription
- event_propertiesEventProperty[]Description
- data_typestring<boolean | number | string>DescriptionAllowedbooleannumberstring
- namestringDescription
- event_typestring<custom>DescriptionAllowedcustom
- idinteger<int64>DescriptionFormatint64
- is_classicbooleanDescriptionDefaultfalse
- is_editablebooleanDescription
- keystringrequiredExampleDescriptionMax Length64Pattern^[a-zA-Z0-9_\- .]+$
- namestringExampleDescription
- project_idinteger<int64>ExampleDescriptionFormatint64
400
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
401
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
403
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
404
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
default
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
curl
curl --request PATCH \
--url https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'PATCH',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}", 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.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Patch.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.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
200
// Return the updated Event
{
"archived": false,
"category": "",
"created": "",
"description": "",
"event_properties": [
{
"data_type": "",
"name": ""
}
],
"event_type": "",
"id": "",
"is_classic": false,
"is_editable": false,
"key": "loaded_new_app",
"name": "Loaded New App",
"project_id": 1000
}400
// Invalid Project ID supplied
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}401
// Invalid credentials
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}403
// You do not have permission to access the specified Event
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}404
// Event not found
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}default
// Unexpected error
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}