Patch a routing plan
PATCH
/api/v1/routing-plans/{routing_plan_id}
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Patch, RequestUri = new Uri("https://external-api.moja-ai.com/api/v1/routing-plans/example"), Headers = { { "X-API-Key", "<X-API-Key>" }, }, Content = new StringContent("{ \"name\": \"example\", \"description\": \"example\", \"is_active\": true, \"allowed_publishers\": [ \"example\" ], \"allowed_buyers\": [ \"example\" ], \"routes\": [ { \"id\": \"example\", \"action\": \"route-to-target\", \"target_id\": \"example\", \"rtb_formula_id\": \"example\", \"ivr_id\": \"example\", \"rtb_group_id\": \"example\", \"predictive_routing_plan_id\": \"example\", \"priority\": 0, \"weight\": 0 } ], \"predictive_routing_plan_id\": \"example\", \"external_id\": \"example\" }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://external-api.moja-ai.com/api/v1/routing-plans/example"
payload := strings.NewReader("{ \"name\": \"example\", \"description\": \"example\", \"is_active\": true, \"allowed_publishers\": [ \"example\" ], \"allowed_buyers\": [ \"example\" ], \"routes\": [ { \"id\": \"example\", \"action\": \"route-to-target\", \"target_id\": \"example\", \"rtb_formula_id\": \"example\", \"ivr_id\": \"example\", \"rtb_group_id\": \"example\", \"predictive_routing_plan_id\": \"example\", \"priority\": 0, \"weight\": 0 } ], \"predictive_routing_plan_id\": \"example\", \"external_id\": \"example\" }")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<X-API-Key>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://external-api.moja-ai.com/api/v1/routing-plans/example';const options = { method: 'PATCH', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"name":"example","description":"example","is_active":true,"allowed_publishers":["example"],"allowed_buyers":["example"],"routes":[{"id":"example","action":"route-to-target","target_id":"example","rtb_formula_id":"example","ivr_id":"example","rtb_group_id":"example","predictive_routing_plan_id":"example","priority":0,"weight":0}],"predictive_routing_plan_id":"example","external_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://external-api.moja-ai.com/api/v1/routing-plans/example \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "name": "example", "description": "example", "is_active": true, "allowed_publishers": [ "example" ], "allowed_buyers": [ "example" ], "routes": [ { "id": "example", "action": "route-to-target", "target_id": "example", "rtb_formula_id": "example", "ivr_id": "example", "rtb_group_id": "example", "predictive_routing_plan_id": "example", "priority": 0, "weight": 0 } ], "predictive_routing_plan_id": "example", "external_id": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”routing_plan_id
required
Routing Plan Id
string
Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
RoutingPlanPatch
object
allowed_publishers
Any of:
Array<string>
null
allowed_buyers
Any of:
Array<string>
null
routes
Any of:
Array<object>
RoutingPlanRouteStable route id (DB uuid). Omitted on create for new steps; returned as id on read.
object
null
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
RoutingPlanResponse
object
id
required
Id
string
org_id
required
Org Id
string
name
required
Name
string
is_active
required
Is Active
boolean
allowed_publishers
Allowed Publishers
Array<string>
allowed_buyers
Allowed Buyers
Array<string>
prefix
Prefix
string
routes
Routes
Array<object>
RoutingPlanRouteResponseobject
action
required
Action
string
priority
Priority
integer
weight
Weight
integer
target
Any of:
null
rtb_formula
Any of:
null
ivr
Any of:
null
rtb_group
Any of:
null
Example
{ "prefix": "", "routes": [ { "action": "route-to-target", "priority": 0, "weight": 0 } ]}Bad Request
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Unauthorized
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Not Found
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Conflict
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}Too Many Requests
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}
