`POST /v1/orgs/{org}/hosts/bulk` (DAWG-78): one action on many hosts.
const url = 'https://api.updawg.net/v1/orgs/example/hosts/bulk';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"action":{"group_id":"example","kind":"add_to_group"},"dry_run":true,"filter":{"distro":["example"],"label":["example"],"reboot_required":["example"],"status":["example"]},"hosts":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.updawg.net/v1/orgs/example/hosts/bulk \ --header 'Content-Type: application/json' \ --data '{ "action": { "group_id": "example", "kind": "add_to_group" }, "dry_run": true, "filter": { "distro": [ "example" ], "label": [ "example" ], "reboot_required": [ "example" ], "status": [ "example" ] }, "hosts": [ "example" ] }'Add to a group needs manage_group; setting labels, refreshing,
decommissioning and deleting need manage_host; a reboot, which opens a
proposal, needs run_job. Decommissioned hosts are skipped and say so,
except by decommission (unchanged) and delete, which acts on nothing
else. At most 5,000 hosts; past that the request is refused whole.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Organization slug.
Request Bodyrequired
Section titled “Request Bodyrequired”Which hosts a bulk action is for: by id, or every host the fleet list shows for a filter. Exactly one of the two.
object
A static member of the group.
object
Set these labels and remove those keys; every other label is kept.
object
object
A full inventory at the next check-in.
object
Open a proposal to reboot them, which somebody then approves. In
window if there is one, else as soon as it is approved.
object
Open a proposal to update their agents to the build channel holds
now (DAWG-46), which somebody then approves. stable unless said.
A host already on it, or whose agent.toml does not permit
self_update, is skipped with the reason.
object
Take them out of the fleet, as DELETE …/hosts/{id} does for one.
One already decommissioned is unchanged.
object
Delete decommissioned hosts for good, as …/purge does for one. A host
that is not decommissioned is skipped. Cannot be undone.
object
Resolve the selection and change nothing: the hosts it would act on.
hst_… ids.
Responses
Section titled “Responses”Done, or what a dry run would do.
object
How many hosts the selection came to (a dry run), or were answered for.
A dry run: the hosts it would act on.
object
Otherwise: one per host, skipped ones included.
object
Why it was skipped.
Empty for an id that is not a host here.
changed, unchanged or skipped.
Examplegenerated
{ "count": 1, "dry_run": true, "hosts": [ { "host_id": "example", "hostname": "example" } ], "proposal": { "id": "example", "number": 1 }, "results": [ { "detail": "example", "host_id": "example", "hostname": "example", "outcome": "example" } ]}Neither or both of hosts and filter; a bad filter or label; more than 5,000 hosts.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}No session.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}Not permitted for this role.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}No such group here.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}update_agent to a channel no agent build has been seen on yet.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}Over the organization’s request limit. Retry-After says when to try again; RateLimit-Limit is the burst.
object
Examplegenerated
{ "detail": "example", "status": 1, "title": "example", "type": "example"}