Create a Project
1 min
POST
https://api.optimizely.com/v2/projects
Body Parameters
- bodyProjectrequiredDescription
- confidence_thresholdnumber<double>ExampleDescriptionFormatdoubleMinimum0.5Maximum1
- dcp_service_idinteger<int64>ExampleDescriptionFormatint64
- descriptionstringExampleDescription
- is_flags_enabledbooleanDescription
- namestringrequiredExampleDescription
- platformstring<web | ios | android | custom>DescriptionDefaultwebAllowedwebiosandroidcustom
- sdksstring[]Description
- statusstring<active | archived>DescriptionDefaultactiveAllowedactivearchived
- third_party_platformstring<salesforce>DescriptionAllowedsalesforce
- web_snippetWebSnippet
- code_revisionintegerDescription
- enable_force_variationbooleanDescriptionDefaultfalse
- exclude_disabled_experimentsbooleanDescriptionDefaultfalse
- exclude_namesbooleanDescriptionDefaulttrue
- include_jquerybooleanDescriptionDefaulttrue
- ip_anonymizationbooleanDescriptionDefaultfalse
- ip_filterstringExampleDescription
- js_file_sizeintegerExampleDescription
- librarystring<jquery-1.11.3-trim | jquery-1.11.3-full | jquery-1.6.4-trim | jquery-1.6.4-full | none>DescriptionDefaultjquery-1.11.3-trimAllowedjquery-1.11.3-trimjquery-1.11.3-fulljquery-1.6.4-trimjquery-1.6.4-fullnone
- project_javascriptstringExampleDescription
- visitor_id_locator_namestringExampleDescription
- visitor_id_locator_typestring<cookie | query | localStorage | js>DescriptionAllowedcookiequerylocalStoragejs
Responses
201
- Project
- account_idinteger<int64>ExampleDescriptionFormatint64
- confidence_thresholdnumber<double>ExampleDescriptionFormatdoubleMinimum0.5Maximum1
- createdstring<date-time>DescriptionFormatdate-time
- dcp_service_idinteger<int64>ExampleDescriptionFormatint64
- descriptionstringExampleDescription
- idinteger<int64>ExampleDescriptionFormatint64
- is_classicbooleanDescription
- is_flags_enabledbooleanDescription
- last_modifiedstring<date-time>DescriptionFormatdate-time
- namestringrequiredExampleDescription
- platformstring<web | ios | android | custom>DescriptionDefaultwebAllowedwebiosandroidcustom
- sdksstring[]Description
- socket_tokenstringExampleDescription
- statusstring<active | archived>DescriptionDefaultactiveAllowedactivearchived
- third_party_platformstring<salesforce>DescriptionAllowedsalesforce
- web_snippetWebSnippet
- code_revisionintegerDescription
- enable_force_variationbooleanDescriptionDefaultfalse
- exclude_disabled_experimentsbooleanDescriptionDefaultfalse
- exclude_namesbooleanDescriptionDefaulttrue
- include_jquerybooleanDescriptionDefaulttrue
- ip_anonymizationbooleanDescriptionDefaultfalse
- ip_filterstringExampleDescription
- js_file_sizeintegerExampleDescription
- librarystring<jquery-1.11.3-trim | jquery-1.11.3-full | jquery-1.6.4-trim | jquery-1.6.4-full | none>DescriptionDefaultjquery-1.11.3-trimAllowedjquery-1.11.3-trimjquery-1.11.3-fulljquery-1.6.4-trimjquery-1.6.4-fullnone
- project_javascriptstringExampleDescription
- visitor_id_locator_namestringExampleDescription
- visitor_id_locator_typestring<cookie | query | localStorage | js>DescriptionAllowedcookiequerylocalStoragejs
default
- Error
- codestring
- messagestring
- messagesobject
- uuidstring<uuid>Formatuuid
curl
curl --request POST \
--url https://api.optimizely.com/v2/projects \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"name": "Test Project",
"platform": "web",
"status": "active",
"web_snippet": {
"exclude_names": true,
"include_jquery": true,
"library": "jquery-1.11.3-trim"
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"name": "Test Project",
"platform": "web",
"status": "active",
"web_snippet": {
"exclude_names": true,
"include_jquery": true,
"library": "jquery-1.11.3-trim"
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.optimizely.com/v2/projects", 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")
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({
"name": "Test Project",
"platform": "web",
"status": "active",
"web_snippet": {
"exclude_names": true,
"include_jquery": true,
"library": "jquery-1.11.3-trim"
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.optimizely.com/v2/projects"
payload = json.dumps({
"name": "Test Project",
"platform": "web",
"status": "active",
"web_snippet": {
"exclude_names": True,
"include_jquery": True,
"library": "jquery-1.11.3-trim"
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Return the created Project
{
"account_id": 12345,
"confidence_threshold": 0.9,
"created": "",
"dcp_service_id": 121234,
"description": "Project for user sign up flow",
"id": 1000,
"is_classic": false,
"is_flags_enabled": false,
"last_modified": "",
"name": "Test Project",
"platform": "",
"sdks": [
""
],
"socket_token": "AABBCCDD~123456789",
"status": "",
"third_party_platform": "",
"web_snippet": {
"code_revision": 0,
"enable_force_variation": false,
"exclude_disabled_experiments": false,
"exclude_names": false,
"include_jquery": false,
"ip_anonymization": false,
"ip_filter": "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
"js_file_size": 63495,
"library": "",
"project_javascript": "alert(\"Active Experiment\")",
"visitor_id_locator_name": "cookie_name",
"visitor_id_locator_type": ""
}
}default
// Unexpected error
{
"code": "",
"message": "",
"messages": {},
"uuid": ""
}