update_request
Changes a request or draft.
Overview
update_request changes only the arguments it's given. headers, queryParams and body each replace what was there, and a query string in url replaces the query parameters. To change a few rows and leave the rest, use setHeaders and removeHeaders, or setQueryParams and removeQueryParams. Use set_auth for auth, set_scripts for scripts and rename_item to rename.
Give a header or query parameter the value [redacted] to keep its existing value. A hidden value in a URL or a body is refused, so leave those arguments out to keep them.
{
"requestId": "5B2C8E41-9D3A-4F67-B0E8-1A4C7D2F6E95",
"headers": [
{ "key": "Authorization", "value": "[redacted]" },
{ "key": "Accept", "value": "application/json" }
]
}Parameters
Prop
Type
A replaced row keeps the place of the first row it replaces. When a key is both removed and set, it ends up set. A query string in url is applied before setQueryParams and removeQueryParams.
{
"requestId": "5B2C8E41-9D3A-4F67-B0E8-1A4C7D2F6E95",
"setHeaders": [{ "key": "Accept", "value": "application/json" }],
"removeHeaders": ["X-Debug"]
}Return Value
The request as get_request returns it, plus changed, which is false when the arguments matched what was there, and warnings.
A read-only workspace's requests can't be changed.
See Also
- get_request: Reads a request or draft as written, with its secrets hidden.
- send_request: Sends a request and returns its response.