Modify an ALB Forwarding Rule by ID
1 min
code examples curl request put \\ \ url 'https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/applicationloadbalancers/{applicationloadbalancerid}/forwardingrules/{forwardingruleid}?pretty=true\&depth=integer%3cint32%3e' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "type" {}, "properties" { "name" "my application load balancer forwarding rule", "protocol" "http", "listenerip" "81 173 1 2", "listenerport" 8080, "httprules" \[ { "name" "my application load balancer http rule", "type" "forward", "conditions" \[ { "type" "header", "condition" "starts with" } ] } ] } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "type" {}, "properties" { "name" "my application load balancer forwarding rule", "protocol" "http", "listenerip" "81 173 1 2", "listenerport" 8080, "httprules" \[ { "name" "my application load balancer http rule", "type" "forward", "conditions" \[ { "type" "header", "condition" "starts with" } ] } ] } }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/applicationloadbalancers/{applicationloadbalancerid}/forwardingrules/{forwardingruleid}?pretty=true\&depth=integer\<int32>", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/applicationloadbalancers/{applicationloadbalancerid}/forwardingrules/{forwardingruleid}?pretty=true\&depth=integer\<int32>") https = net http new(url host, url port) https use ssl = true request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "type" {}, "properties" { "name" "my application load balancer forwarding rule", "protocol" "http", "listenerip" "81 173 1 2", "listenerport" 8080, "httprules" \[ { "name" "my application load balancer http rule", "type" "forward", "conditions" \[ { "type" "header", "condition" "starts with" } ] } ] } }) response = https request(request) puts response read body import requests import json url = "https //api ionos com/cloudapi/v6/datacenters/{datacenterid}/applicationloadbalancers/{applicationloadbalancerid}/forwardingrules/{forwardingruleid}?pretty=true\&depth=integer\<int32>" payload = json dumps({ "type" {}, "properties" { "name" "my application load balancer forwarding rule", "protocol" "http", "listenerip" "81 173 1 2", "listenerport" 8080, "httprules" \[ { "name" "my application load balancer http rule", "type" "forward", "conditions" \[ { "type" "header", "condition" "starts with" } ] } ] } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // successful operation { "id" "15f67991 0f51 4efc a8ad ef1fb31a480c", "type" {}, "href" "\<resource uri>", "metadata" { "etag" "45480eb3fbfc31f1d916c1eaa4abdcc3", "createddate" "2015 12 04t14 34 09 809z", "createdby" "user\@example com", "createdbyuserid" "user\@example com", "lastmodifieddate" "2015 12 04t14 34 09 809z", "lastmodifiedby" "user\@example com", "lastmodifiedbyuserid" "63cef532 26fe 4a64 a4e0 de7c8a506c90", "state" "available" }, "properties" { "name" "my application load balancer forwarding rule", "protocol" "http", "listenerip" "81 173 1 2", "listenerport" 8080, "clienttimeout" 50, "servercertificates" \[ "" ], "httprules" \[ { "name" "my application load balancer http rule", "type" "forward", "targetgroup" "96e514d0 73e4 4abd 8fbc c0f53b79bfae", "dropquery" true, "location" "www ionos com", "statuscode" 301, "responsemessage" "application down", "contenttype" "text/html", "conditions" \[ { "type" "header", "condition" "starts with", "negate" false, "key" "forward at", "value" "friday" } ] } ] } }// any erroneous status code 400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported http method), 415 (unsupported content type, 422 (validation error), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance) { "httpstatus" 400, "messages" \[ { "errorcode" "123", "message" "error message example " } ] }