Fleet workflow
Warning: This content is a preview of the documentation. The full documentation, along with code samples, is still in progress. Please provide feedback via the feedback mechanism at the bottom of this page.
The fleet workflow covers getting a build configuration, getting (or creating) a fleet, and updating a fleet.
Before using the Build workflow, you must have a CCD API key and a UGS service account with the following roles:
- Multiplay API Viewer
- Multiplay API Editor
Refer to Project roles and Service account authentication.
Note: Throughout this workflow you need to refer to your Unity project ID and environment ID. You can find your project ID on the project settings page, and the environment ID on the environments page.
The following diagram shows a simplified version of the workflow:
Get a build configuration
You can get a build configuration using the List build configurations API. Refer to Build configuration workflow.
Note: Make sure to save the build configuration ID. If you already have the build configuration ID, continue to Get a fleet.
The following code sample shows how to get an existing build configuration using curl:
curl -X GET \
-H "Authorization: Basic <SERVICE_ACCOUNT_CREDENTIALS>" \
https://services.api.unity.com/multiplay/build-configurations/v1/projects/{projectId}/environments/{environmentId}/build-configurations
Refer to the List build configurations API documentation for example response bodies and parameter documentation.
Get a fleet
The process for getting a fleet varies depending on whether you want to use an existing fleet or create a new one. If you opt to use an existing fleet but want to update it, refer to Update a fleet.
Get an existing fleet
You can get a fleet ID by its name using the List fleets API. If you already know the fleet ID, and you want to update the fleet, continue to Update a fleet.
The following code sample shows how to get an existing fleet using curl:
curl -X GET \
-H "Authorization: Basic <SERVICE_ACCOUNT_CREDENTIALS>" \
https://services.api.unity.com/multiplay/fleets/v1/projects/{projectId}/environments/{environmentId}/fleets
Refer to the List fleets API documentation for example response bodies and parameter documentation.
Create a new fleet
You can create a fleet using the Create a fleet API. When creating a fleet, you need to configure the regions in which to place your game servers. You can find the valid region IDs from the List Template Fleet Regions API. You can call this API with curl:
curl -X GET \
-H "Authorization: Basic <SERVICE_ACCOUNT_CREDENTIALS>" \
https://services.api.unity.com/multiplay/fleets/v1/projects/{projectId}/environments/{environmentId}/fleets/regions
The following code sample shows how to create a new fleet using curl:
curl -X POST \
-H "Authorization: Basic <SERVICE_ACCOUNT_CREDENTIALS>" \
-H "Content-Type: application/json" \
-d '{"buildConfigurations": [<BUILD_CONFIG_ID>], "name": "Example Fleet", "osFamily": "LINUX", "osID": "1111a1a1-a11a-11a1-a1a1-1a111aa11111", "regions": [{"maxServers": 10, "minAvailableServers": 10, "regionID": "<REGION_ID>"}]}' \
https://services.api.unity.com/multiplay/fleets/v1/projects/{projectId}/environments/{environmentId}/fleets
Refer to the Create a fleet API documentation for example response bodies and parameter documentation.
Update a fleet
You can update an existing fleet using the Update a fleet API.
Note: Only update a fleet if you’re using an existing fleet. You shouldn’t need to use the update workflow if you’re creating a new fleet.
The following code sample shows how to update a fleet using curl:
curl -X PUT \
-H "Authorization: Basic <SERVICE_ACCOUNT_CREDENTIALS>" \
-H "Content-Type: application/json" \
-d '{"buildConfigurations": [<BUILD_CONFIG_ID>], "deleteTTL": 604800, "disabledDeleteTTL": 604800, "name": "Example Fleet", "shutdownTTL": 900}' \
https://services.api.unity.com/multiplay/fleets/v1/projects/{projectId}/environments/{environmentId}/fleets/{fleetId}
Refer to the Update a fleet API documentation for example response bodies and parameter documentation.