Update a computer
PATCH/computers/:computerId
Changes a computer's policy, directory bridging or EDR integration. The first matching rule wins:
- If the body contains a non-empty
ip, only the last known IP address is updated and the rest of the body is ignored. A plainusermay do this only for a computer that user can administer (directly or through a group); otherwise 403. Anipthat is empty ornullis ignored and the request falls through to rule 2. - Otherwise the caller must be
superadminoradmin(403 for a plainuser), andpolicy,directory_bridging/system_domainandedr_integrationare applied together in one save.
Notes on the body:
edr_integrationis a top-level field in the request body holding the id of an EDR configuration. The server stores it atconfig.policies.edr_integration, and that is where responses show it. The id must be a valid 24-character object id (anything else, including an empty string, returns 400ValidationError) but it is stored without checking that the EDR configuration exists.policy.manage_local_sidsis accepted but ignored; the stored value is kept.policy.strict_securecan betrueonly while protect mode (policy.secure) ends uptrue.- Scan mode cannot be turned off while offline access management is enabled on the computer.
directory_bridgingandsystem_domainapply to Linux and macOS computers only (422 otherwise).system_domainis required whendirectory_bridgingiscentrify,powerbroker,sssdordirectory_utility, and must name a configured directory (LDAP) domain. Forsecureoneornonethe domain is cleared and the computer is marked non-domain.system_domainwithoutdirectory_bridgingreturns 422.- Changing
policyon a Linux computer also stages or applies sudoers policy.
The body can be JSON or urlencoded (nested keys such as policy[scan]=true work). A body sent with any other content type is not parsed and the request is treated as an empty update. An empty update ({}, or fields the route does not know) saves nothing new and returns the computer with 200. Unknown fields such as cn are ignored. Boolean policy values sent as the strings "true" or "false" are accepted; a policy value that is not an object is ignored. Malformed JSON returns 400 with {error}.
Required role: any authenticated user for an ip update of a computer the user administers; otherwise superadmin or admin.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
- 422
Success. When only ip was sent the body is {message}; otherwise it is the full updated computer.
Validation failed while saving: directory_bridging is not one of the allowed values, or edr_integration is not a valid object id (body {name: "ValidationError", message}); or the JSON body is malformed (body {error}).
No token, or the token is invalid or expired. The body is {message}: No auth token provided when no token is sent, otherwise the token check's message (jwt expired, jwt malformed, invalid signature, invalid token, jwt signature is required). Send Authorization: Bearer <token> exactly: the server drops the first seven characters of the header and reads the rest as the token, so a different scheme or an extra space fails. If Authorization is absent, the server reads a token field in the body, then a token query parameter, then x-access-token. Routes that validate query fields reject ?token= with 400 InvalidQuery.
The token's role is not allowed for this operation, or the token's scopes exclude the route
(Scope not allowed by token).
No record has the :id in the path (the id is malformed or unknown). The body is the bare text Invalid <Type> ID (for example Invalid Computer ID, Invalid User ID) with Content-Type text/html; charset=utf-8, not JSON. Some routes return an empty body.
Conflict, with a {message} body: strict_secure requested while protect mode is off, or scan mode disabled while offline access management is enabled.
Invalid ip (anything that is not a dotted IPv4 address, including IPv6 and numbers); directory bridging options sent for a Windows computer; unknown system_domain ("Invalid domain specified for the system"); directory_bridging of sssd, centrify, powerbroker or directory_utility without a valid system_domain; or system_domain without directory_bridging.