Manage devices

You can use the APIv2 to fully manage a device. Below are some examples of actions that can be taken.

Activating a device

When a device is activated in Fleet Manager, the import of the configuration is executed as an additional step.
So, after activating a device with APIv2, this step needs to be taken too.

First, activate the device (endpoint):

curl --request POST \
     --url '<<url>>:443/api/agents/activate' \
     --header 'Api-Version: 2' \
     --header "Api-Application: $application_id" \
     --header "Api-Company: $company_id" \
     --header 'content-type: application/json' \
     --header "Authorization: Bearer $bearer_token"
     --data '
     [
          {
               "publicId": "$agent_id",
               "name": "$name_of_agent"
          }
     ]'

Second, import the configuration (endpoint):

curl --request PUT \
     --url '<<url>>:443/api/agents/configuration/import' \
     --header 'Api-Version: 2' \
     --header "Api-Application: $application_id" \
     --header "Api-Company: $company_id" \
     --header 'content-type: application/json' \
     --header 'Api-Branding: <<apiBranding>>' \
     --header "Authorization: Bearer $bearer_token"
     --data '
     [
          {
               "publicId": "$agent_id"
          }
     ]'