Consultez l'API Chrome Management Enrollment Tokens pour obtenir une présentation des fonctionnalités de l'API.
Toutes les requêtes affichées sur cette page utilisent les variables suivantes :
$TOKEN: jeton OAuth 2.0$CUSTOMER: ID du client ou littéralmy_customer
Créer un jeton d'enregistrement
Pour créer un jeton d'enregistrement pour un appareil de navigateur, utilisez le point de terminaison /enrollmentTokens avec HTTP POST. Vous pouvez éventuellement spécifier un paramètre de requête enrollmentTokenId pour attribuer un ID de jeton personnalisé.
Requête
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens" \
-d '{
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER",
"orgUnitId": "03ph8a2z3v"
}'
Réponse
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
Récupérer un jeton d'enregistrement
Pour récupérer un jeton d'enregistrement unique, utilisez le point de terminaison /enrollmentTokens/{token_permanent_id} avec HTTP GET.
Requête
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>"
Réponse
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
Lister les jetons d'enregistrement
Pour lister les jetons d'enregistrement, utilisez le point de terminaison /enrollmentTokens avec HTTP GET.
Vous pouvez contrôler la pagination à l'aide des paramètres pageSize (100 par défaut et au maximum) et pageToken. Spécifiez un filter pour affiner les résultats.
Exemples de requêtes de filtre
# Filter by token state
filter=token_state=ACTIVE
# Filter by Organizational Unit path
filter=org_unit_path=/Marketing
# Filter by Organizational Unit path containing spaces
filter=org_unit_path='/Browser Management'
# Filter by Organizational Unit ID
filter=org_unit_id=03ph8a2z3v
# Filter by token state, Organizational Unit path, and device type
filter=token_state=ACTIVE AND org_unit_path=/Marketing AND device_type=CHROME_BROWSER
Requête
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens?pageSize=2&filter=token_state=ACTIVE"
Réponse
{
"enrollmentTokens": [
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId1>",
"tokenPermanentId": "<tokenPermanentId1>",
"token": "<tokenValue1>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user1@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
},
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId2>",
"tokenPermanentId": "<tokenPermanentId2>",
"token": "<tokenValue2>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T21:30:00.000Z",
"creatorId": "user2@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
],
"nextPageToken": "<nextPageToken>"
}
Révoquer un jeton d'inscription
Pour révoquer un jeton d'enregistrement, utilisez le point de terminaison /enrollmentTokens/{token_permanent_id}:revoke avec HTTP POST.
Requête
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>:revoke" \
-d '{}'
Réponse
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_REVOKED",
"createTime": "2024-04-23T22:00:00.000Z",
"revokeTime": "2024-04-24T10:15:00.000Z",
"creatorId": "user@example.com",
"revokerId": "admin@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}