Create a Schedule Change for a flag in an environment
1 min
POST
http://localhost:3002//projects/{project_id}/flags/{flag_key}/schedules
Path Parameters
- project_idintegerrequired
- flag_keystringrequired
Body Parameters
- bodyScheduledChangeCreateRequestrequired
- account_idintegerrequiredDescription
- actionsScheduleAction[]requiredDescription
- subjectobjectrequiredDescription
- keystringDescription
- typestring<flag | rule>DescriptionAllowedflagrule
- changed_elementstring<status | percentage_included | audience_conditions>requiredAllowedstatuspercentage_includedaudience_conditions
- valueActionValuerequiredDescription
- object
- object
- scheduleobjectrequiredDescription
- ScheduledTime
- timestringrequiredExampleDescription
- time_zonestringrequiredExampleDescription
- datestringrequiredExampleDescription
- environmentstringrequired
- approval_requiredboolean
- reasonstring
Responses
201
- ScheduledChange
- idintegerrequiredDescription
- account_idintegerrequiredDescription
- project_idintegerrequiredDescription
- flag_keystringrequiredDescription
- environmentstringrequiredDescription
- actionsScheduleAction[]requiredDescription
- subjectobjectrequiredDescription
- keystringDescription
- typestring<flag | rule>DescriptionAllowedflagrule
- changed_elementstring<status | percentage_included | audience_conditions>requiredAllowedstatuspercentage_includedaudience_conditions
- valueActionValuerequiredDescription
- object
- object
- scheduleobjectrequiredDescription
- ScheduledTimeWithUTC
- timestringrequiredExampleDescription
- time_zonestringrequiredExampleDescription
- datestringrequiredExampleDescription
- utc_timestringrequiredExampleDescription
- statusstringrequiredDescription
- approval_statusstring<pending | accepted | rejected | withdrawn>DescriptionAllowedpendingacceptedrejectedwithdrawn
- completed_atstring<date-time>requiredExampleDescriptionFormatdate-time
- updated_atstring<date-time>requiredExampleDescriptionFormatdate-time
- created_atstring<date-time>requiredExampleDescriptionFormatdate-time
- updated_bystringrequiredDescription
- created_bystringrequiredDescription
401
- ErrorResponseExample
{ "details": "Not authenticated", "status": 401 }- detailsstringrequiredDescription
- statusintegerrequiredExampleDescription
422
- HTTPValidationError
- detailValidationError[]
- locobject[]requiredDescription
- msgstringrequiredDescription
- typestringrequiredDescription
- statusintegerExampleDescription
curl
curl --request POST \
--url http://localhost:3002//projects/{project_id}/flags/{flag_key}/schedules \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"account_id": "",
"actions": [
{
"subject": {},
"changed_element": "",
"value": {}
}
],
"schedule": {
"time": 1214,
"time_zone": "Etc/UTC",
"date": "2023-07-30"
},
"environment": ""
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"account_id": "",
"actions": [
{
"subject": {},
"changed_element": "",
"value": {}
}
],
"schedule": {
"time": 1214,
"time_zone": "Etc/UTC",
"date": "2023-07-30"
},
"environment": ""
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("http://localhost:3002//projects/{project_id}/flags/{flag_key}/schedules", 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("http://localhost:3002//projects/{project_id}/flags/{flag_key}/schedules")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"account_id": "",
"actions": [
{
"subject": {},
"changed_element": "",
"value": {}
}
],
"schedule": {
"time": 1214,
"time_zone": "Etc/UTC",
"date": "2023-07-30"
},
"environment": ""
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "http://localhost:3002//projects/{project_id}/flags/{flag_key}/schedules"
payload = json.dumps({
"account_id": "",
"actions": [
{
"subject": {},
"changed_element": "",
"value": {}
}
],
"schedule": {
"time": 1214,
"time_zone": "Etc/UTC",
"date": "2023-07-30"
},
"environment": ""
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Successful Response
{
"id": 0,
"account_id": 0,
"project_id": 0,
"flag_key": "",
"environment": "",
"actions": [
{
"subject": {
"key": "",
"type": ""
},
"changed_element": "",
"value": {}
}
],
"schedule": {},
"status": "",
"approval_status": "",
"completed_at": "2023-04-15T20:14+0000",
"updated_at": "2023-04-15T20:14+0000",
"created_at": "2023-04-15T20:14+0000",
"updated_by": "",
"created_by": ""
}401
// Not Authenticated
{
"details": "",
"status": 400
}422
// Validation Error
{
"detail": [
{
"loc": [
{}
],
"msg": "",
"type": ""
}
],
"status": 422
}