Visita la API de Chrome Management Enrollment Tokens para obtener una descripción general de las funciones de la API.
Todas las solicitudes que se muestran en esta página usan las siguientes variables:
$TOKEN: Token de OAuth 2.0$CUSTOMER: Es el ID del cliente o el literalmy_customer.
Crea un token de inscripción
Para crear un token de inscripción nuevo para un dispositivo de navegador, usa el extremo /enrollmentTokens con HTTP POST. De forma opcional, puedes especificar un parámetro de consulta enrollmentTokenId para asignar un ID de token personalizado.
Solicitud
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"
}'
Respuesta
{
"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"
}
Recupera un token de inscripción
Para recuperar un solo token de inscripción, usa el extremo /enrollmentTokens/{token_permanent_id} con GET de HTTP.
Solicitud
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>"
Respuesta
{
"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"
}
Enumera los tokens de inscripción
Para enumerar los tokens de inscripción, usa el endpoint /enrollmentTokens con GET de HTTP.
Puedes controlar la paginación con los parámetros pageSize (máximo y predeterminado: 100) y pageToken. Especifica un filter para limitar los resultados.
Ejemplos de consultas de filtro
# 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
Solicitud
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens?pageSize=2&filter=token_state=ACTIVE"
Respuesta
{
"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>"
}
Revoca un token de inscripción
Para revocar un token de inscripción, usa el extremo /enrollmentTokens/{token_permanent_id}:revoke con POST de HTTP.
Solicitud
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>:revoke" \
-d '{}'
Respuesta
{
"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"
}