kibana/docs/api/synthetics/params/edit-param.asciidoc
Shahzad 0ff9a8a9d9
[Synthetics] Fixes partial updates for params and params viewing (#195866)
## Summary

Fixes https://github.com/elastic/kibana/issues/167781

In docs we says that only key/value pairs are required, but in actual
edit, that means rest of the data was being lost on edits

Allow partial updates to params edit API !!

This PR makes sure prev objects is fetched and merged with new data
hence allowing partial updates !!

We are also allowing the ability to view value of the secret once it's
saved via API !!

### Value is hidden
Param value will not be visible unless user is `super_user` or
`kibana_admin`, though user can assign new value.

---------

Co-authored-by: Justin Kambic <jk@elastic.co>
2024-10-25 17:06:52 +02:00

70 lines
1.8 KiB
Text

[[edit-parameter-by-id-api]]
== Edit Parameter by ID API
++++
<titleabbrev>Edit Parameter</titleabbrev>
++++
Edits a parameter with the specified ID.
=== {api-request-title}
`PUT <kibana host>:<port>/api/synthetics/params`
`PUT <kibana host>:<port>/s/<space_id>/api/synthetics/params`
=== {api-prereq-title}
You must have `all` privileges for the *Synthetics* feature in the *{observability}* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.
[[parameter-edit-path-params]]
==== Path Parameters
`id`::
(Required, string) The unique identifier of the parameter to be edited.
[[parameter-edit-request-body]]
==== Request body
The request body can contain the following attributes, it can't be empty at least one attribute is required.:
`key`::
(Optional, string) The key of the parameter.
`value`::
(Optional, string) The updated value associated with the parameter.
`description`::
(Optional, string) The updated description of the parameter.
`tags`::
(Optional, array of strings) An array of updated tags to categorize the parameter.
[[parameter-edit-example]]
==== Example
Here is an example of a PUT request to edit a parameter by its ID:
[source,sh]
--------------------------------------------------
PUT /api/synthetics/params/param_id1
{
"key": "updated_param_key",
"value": "updated-param-value",
"description": "Updated Param to be used in browser monitor",
"tags": ["authentication", "security", "updated"]
}
--------------------------------------------------
The API returns the updated parameter as follows:
[source,json]
--------------------------------------------------
{
"id": "param_id1",
"key": "updated_param_key",
"value": "updated-param-value",
"description": "Updated Param to be used in browser monitor",
"tags": ["authentication", "security", "updated"]
}
--------------------------------------------------