Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API design] Enroll Android #26285

Open
wants to merge 9 commits into
base: docs-v4.66.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions articles/role-based-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ GitOps is an API-only and write-only role that can be used on CI/CD pipelines.
| View, edit, and delete APNs certificate | | | | ✅ | |
| View, edit, and delete Apple Business Manager (ABM) connections | | | | ✅ | |
| View, edit, and delete Volume Purchasing Program (VPP) connections | | | | ✅ | |
| Connect Android Enterprise | | | | ✅ | |
| View disk encryption key for macOS and Windows hosts | ✅ | ✅ | ✅ | ✅ | |
| Edit OS updates for macOS, Windows, iOS, and iPadOS hosts | | | ✅ | ✅ | ✅ |
| Create, edit, resend and delete configuration profiles for macOS and Windows hosts | | | ✅ | ✅ | ✅ |
Expand Down
118 changes: 118 additions & 0 deletions docs/Contributing/API-for-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,10 @@ The MDM endpoints exist to support the related command-line interface sub-comman
- [Upload VPP content token](#upload-vpp-content-token)
- [Disable VPP](#disable-vpp)
- [SCEP proxy](#scep-proxy)
- [Get Android Enterprise signup URL](#get-android-enterprise-signup-url)
- [Connect Android Enterprise](#connect-android-enterprise)
- [Delete Android Enterprise](#delete-android-enterprise)
- [Get Android enrollment token](#get-android-enrollment-token)


### Generate Apple Business Manager public key (ADE)
Expand Down Expand Up @@ -1279,6 +1283,120 @@ Content-Type: application/octet-stream

This endpoint is used to proxy SCEP requests to the configured SCEP server. It uses the [SCEP protocol](https://datatracker.ietf.org/doc/html/rfc8894). The `identifier` is in the format `hostUUID,profileUUID`.

### Get Android Enterprise signup URL
marko-lisica marked this conversation as resolved.
Show resolved Hide resolved

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.

This endpoint is used to generate a URL, which opens Google's wizard to create Android Enterprise.

`GET /api/v1/fleet/android_enterprise/signup_url`

#### Example

`GET /api/v1/fleet/android_enterprise/signup_url`

##### Default response

`Status: 200`

```json
{
"android_enterprise_signup_url": "https://enterprise.google.com/signup/android/email?origin=android&thirdPartyToken=S7512150D1D59A3BK"
}
```

### Connect Android Enterprise

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.
This endpoint is used to connect (bind) Android Enterprise to Fleet and to turn on Android MDM features.

`GET /api/v1/fleet/android_enterprise/connect/:token`

This is callback URL that will be open after user completes Google's signup flow. It will self-close and return user to settings page.

#### Parameters

| Name | Type | In | Description |
| ---- | ------ | ---- | ------------------------------------ |
| token | string | path | **Required.** The signup token associated with Android Enterprise in Fleet. |
| enterpriseToken | string | query | **Required.** The enterprise token that's returned from Google API. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to match Google's API exactly? If not we should follow our usual conventions and not use camelcase

Suggested change
| enterpriseToken | string | query | **Required.** The enterprise token that's returned from Google API. |
| enterprise_token | string | query | **Required.** The enterprise token that's returned from Google API. |



#### Example

`GET /api/v1/fleet/android_enterprise/connect/6177a9cb410ff61f20015ad?enterpriseToken=FEKXFy427_jz9Nfhq19SGDOKR2nZ4ZqhSAuYqOQw1B1G2OdBkQ5IDfSkLiO0rUqL8ptAXoa5_cZdh5GBRdyLj29m5A8DcZ1dptSp6YMNY6MQv0UiqcQqRC8D`

##### Default response

`Status: 200`

```
<html><!-- self-closing page --></html>
```

### Delete Android Enterprise

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.
This endpoint is used to delete Android Enterprise. Once deleted, hosts that belong to Android Enterprise will be un-enrolled and Android MDM features will be turned off.

`DELETE /api/v1/fleet/android_enterprise/`

#### Example

`DELETE /api/v1/fleet/android_enterprise`

##### Default response

`Status: 200`

### Create Android enrollment token

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.
This endpoint is used to generate enrollment token and enrollment URL which opens wizard (settings app) to enroll Android host.

`POST /api/v1/fleet/android_enterprise/enrollment_token`

#### Parameters

| Name | Type | In | Description |
| ---- | ------ | ---- | ------------------------------------ |
| id | integer | path | **Required.** The ID of Android Enterprise in Fleet. |

#### Example

`POST /api/v1/fleet/android/enterprise/5/enrollment_token`

##### Default response

`Status: 200`

```json
{
"android_enrollment_token": "OJDDNCYSEZPAUZZOXHDF",
"android_enrollment_url": "https://enterprise.google.com/android/enroll?et=OJDDNCYSEZPAUZZOXHDF"
}
```
marko-lisica marked this conversation as resolved.
Show resolved Hide resolved

### Get Android Enterprise server-sent event
marko-lisica marked this conversation as resolved.
Show resolved Hide resolved

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.

This endpoint is used to get server-sent events (SSE) messages, so that UI know if Android Enterprise is created and bound to Fleet.

`GET /api/v1/fleet/android_enterprise/signup_sse`

#### Example

`GET /api/v1/fleet/android_enterprise/signup_sse`

##### Default response

`Status: 200`

```
Android Enterprise successfully connected
```

## Get or apply configuration files

These API routes are used by the `fleetctl` CLI tool. Users can manage Fleet with `fleetctl` and [configuration files in YAML syntax](https://fleetdm.com/docs/using-fleet/configuration-files/).
Expand Down
12 changes: 12 additions & 0 deletions docs/Contributing/Audit-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,18 @@ Generated when a user disables automatic MDM migration for Windows hosts, if Win

This activity does not contain any detail fields.

## enabled_android_mdm

Generated when a user turns on MDM features for all Android hosts.

This activity does not contain any detail fields.

## disabled_android_mdm

Generated when a user turns off MDM features for all Android hosts.

This activity does not contain any detail fields.

## ran_script

Generated when a script is sent to be run for a host.
Expand Down
35 changes: 35 additions & 0 deletions docs/REST API/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,12 @@ Returns the count of all hosts organized by status. `online_count` includes all
"name": "Fedora Linux",
"description": "All Fedora hosts",
"label_type": "builtin"
},
{
"id": 16,
"name": "Android",
"description": "All Android hosts",
"label_type": "builtin"
}
],
"platforms": [
Expand Down Expand Up @@ -2602,6 +2608,10 @@ Returns the count of all hosts organized by status. `online_count` includes all
{
"platform": "windows",
"hosts_count": 12044
},
{
"platform": "Android",
"hosts_count": 200
}
]
}
Expand Down Expand Up @@ -6320,6 +6330,7 @@ This endpoint returns the list of custom MDM commands that have been executed.
- [Get Apple Push Notification service (APNs)](#get-apple-push-notification-service-apns)
- [List Apple Business Manager (ABM) tokens](#list-apple-business-manager-abm-tokens)
- [List Volume Purchasing Program (VPP) tokens](#list-volume-purchasing-program-vpp-tokens)
- [Get Android Enterprise](#get-android-enterprise)

### Get Apple Push Notification service (APNs)

Expand Down Expand Up @@ -6461,6 +6472,30 @@ _Available in Fleet Premium_
}
```

### Get Android Enterprise

> **Experimental feature.** This feature is undergoing rapid improvement, which may result in breaking changes to the API or configuration surface. It is not recommended for use in automated workflows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marko-lisica needs description for the endpoint

`GET /api/v1/fleet/android_enterprise`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this endpoint? I already added mdm.android_enabled_and_configured to config, which serves as an indicator that an Android enterprise exists for frontend.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have similar endpoint for APNS. I guess we could add info to the config, but I think we should be consistent with Apple and have the endpoint to get Android Enterprise info. Wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just for debug/API, and not frontend? If so, this endpoint could be added at a later story whenever frontend actually uses it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for this page: link to Figma


#### Parameters

None.

#### Example

`GET /api/v1/fleet/android_enterprise`

##### Default response

`Status: 200`

```json
{
"android_enterprise_id": "LC0445szuv"
Copy link
Member

@getvictor getvictor Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend adding a "Last status update" timestamp. This will be the timestamp of the last PubSub message received by Fleet server. This would be a good indicator whether the connection is healthy.

Note: there would be no timestamp until the 1st device enrolls.

}
```

---

## Policies
Expand Down
Loading