Update nested parameters via web api

hi all,

I can only update one host parameters every time, its possible to update many host parameters at once ?

Update a nested parameter for a host group
PUT /api/domains/:domain_id/parameters/:id ← this update only per request

thank you all

Hi,

to my knowledge (and according to the API documentation), there is no way to edit several parameters in a single API call.
Maybe there is some undocumented method/endpoint I don’t know about that the WebUI uses internally, but that would need to be answered by one of the devs.

1 Like

Exactly you are right and we can do that via WebUI, thats why I asked.

And its not usefull to call update method several times to update nested hosts for a host. this cause to performance issue!

like always thank you so much @areyus

I hope one of the dev can answer me…

No one know the answer ?

I have looked up what the webui is doing, and it looks like this is the trick:

domain[domain_parameters_attributes][0][name]	"bar"
domain[domain_parameters_attributes][0][parameter_type]	"string"
domain[domain_parameters_attributes][0][value]	"bar"
domain[domain_parameters_attributes][0][hidden_value]	"0"
domain[domain_parameters_attributes][0][_destroy]	"false"
domain[domain_parameters_attributes][0][id]	"1216"
domain[domain_parameters_attributes][1][name]	"foo"
domain[domain_parameters_attributes][1][parameter_type]	"string"
domain[domain_parameters_attributes][1][value]	"foo"
domain[domain_parameters_attributes][1][hidden_value]	"0"
domain[domain_parameters_attributes][1][_destroy]	"false"
domain[domain_parameters_attributes][1][id]	"1217"

With developer tools in your browser, you can check what requests the GUI is sending on certain actions, this is what I found.
I hope this helps, but keep in mind since these are undocumented parameters, this might potentially change in the future without further notice. We are using something similar ourselfs in some API calls for creating hosts with already set Puppet ENC params and have not had any breakages for years, but these tings are for sure a case of “if it breaks, you get to keep both pieces” :wink:

1 Like

Thank you so much @areyus, this point is very important!

I’ll send you my solution for that!
I solve it already but with another parameter maybe because it’s for host parameters.

Thanks again