createEnrollmentToken method

Future<CreateEnrollmentTokenResponse> createEnrollmentToken(
  1. String enterpriseId, {
  2. String? deviceType,
  3. String? $fields,
})

Returns a token for device enrollment.

The DPC can encode this token within the QR/NFC/zero-touch enrollment payload or fetch it before calling the on-device API to authenticate the user. The token can be generated for each device or reused across multiple devices.

Request parameters:

enterpriseId - The ID of the enterprise.

deviceType - Whether it’s a dedicated device or a knowledge worker device. Possible string values are:

  • "unknown" : This value is unused
  • "dedicatedDevice" : This device is a dedicated device.
  • "knowledgeWorker" : This device is required to have an authenticated user.

$fields - Selector specifying which fields to include in a partial response.

Completes with a CreateEnrollmentTokenResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<CreateEnrollmentTokenResponse> createEnrollmentToken(
  core.String enterpriseId, {
  core.String? deviceType,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (deviceType != null) 'deviceType': [deviceType],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'androidenterprise/v1/enterprises/' +
      commons.escapeVariable('$enterpriseId') +
      '/createEnrollmentToken';

  final response_ = await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
  );
  return CreateEnrollmentTokenResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}