Manage License-based Assets
Programatically add or remove licenses for your Google Workspace or Office 365 subscriptions
Customers with active Google Workspace or Microsoft Office 365 subscriptions can provision additional licenses for their domains. Customers on flexible (not annual) subscriptions can also decrease the number of their licenses.
Assets API is a programmatic way to increase or decrease your Google Workspace, or Microsoft Office 365 licenses with an easy to use RESTful API.
API Reference
The Assets API reference is available at https://developer.doit.com/reference/assets
Required Permissions
Licenses Manager permissions (part of
IT Manager
built-in role)
Licenses API has the following methods:
assets.list
The assets.list method provides a list of all the assets managed by DoiT.
You can filter the list by using one or more of the following parameters:
Parameter | Description |
---|---|
filter | string An expression for filtering the results of the request. The syntax is key:[<value>] . For example, the type:google-cloud will filter the list to include only Google Cloud billing account related assets.Supported filter keys: - type is either 'google-cloud', 'google-cloud-project', 'amazon-web-services', 'g-suite', 'office-365'.Learn more about how to use filter *.list requests. |
Sample assets.list Request to list all managed Google Cloud billing accounts and active Google Workspace subscriptions:
curl --location --request GET 'https://api.doit.com/billing/v1/assets?filter=type:g-suite|type:google-cloud' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data-raw ''
your-api-key
Always replace "your-api-key" with your actual API key as explained at Getting Started
Sample assets.list Response:
{
"assets": [
{
"id": "amazon-web-services-028115051195",
"type": "amazon-web-services",
"licenseQty": "N/A",
"assetName": "my-aws-account (028115051195)",
"url": "https://app.doit.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/amazon-web-services"
},
{
"id": "g-suite-1834534158",
"type": "g-suite",
"licenseQty": "850",
"assetName": "G Suite Business (mydomain.com)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/g-suite"
},
{
"id": "g-suite-849299858",
"type": "g-suite",
"licenseQty": "0",
"assetName": "Cloud Identity Free (mydomain.com)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/g-suite"
},
{
"id": "google-cloud-01FE64-BB73DE-4BA1D8",
"type": "google-cloud",
"licenseQty": "N/A",
"assetName": "doit.mybillingaccount.com (21FE64-BB93DE-4BA1D8)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/google-cloud"
}
]
}
assets.patch
Update the asset to have more or fewer licenses. While you can always add more licenses, you won't be able to decrease the number of licenses for annual/commitment subscriptions.
Sample assets.patch Request:
curl --location --request PATCH 'https://api.doit.com/billing/v1/assets/g-suite-1834534158' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data-raw '"quantity": 855'
How to use licenseQty parameter
Quantity in the scope of
assets.patch
means how many licences you'd like your subscription to have AFTER a successful patch operation. For example, if your subscription has 850 licenses and you set the quantity to 855, you're effectively adding 5 licenses.
your-api-key
Always replace "your-api-key" with your actual API key as explained at Getting Started
Sample assets.patch Response:
{
"id": "g-suite-1834534158",
"type": "g-suite",
"properties": {
"customerDomain": "mydomain.com",
"customerID": "C02q3hlmm",
"reseller": "[email protected]",
"subscription": {
"BillingMethod": "ONLINE",
"CreationTime": 1566204362147,
"PurchaseOrderID": "",
"ResourceUIURL": "https://www.google.com/a/cpanel/mydomain.com/AdminHome#DomainSettings/notab=1\u0026subtab=subscriptions",
"SkuID": "Google-Apps-For-Business",
"SkuName": "G Suite Basic",
"Status": "ACTIVE",
"ID": "950157319",
"Plan": {
"CommitmentInterval": null,
"IsCommitmentPlan": false,
"PlanName": "FLEXIBLE"
},
"RenewalSettings": null,
"Seats": {
"LicensedNumberOfSeats": 8,
"MaximumNumberOfSeats": 9,
"NumberOfSeats": 0
}
},
"settings": null
}
}
Response Body
If successful, the response body contains an instance of Asset
object
{
"id": string,
"type": string,
"properties": {
"customerDomain": string,
"customerID": string,
"reseller": string,
"subscription": {
"BillingMethod": string,
"CreationTime": number,
"PurchaseOrderID": string,
"ResourceUIURL": string,
"SkuID": string,
"SkuName": string,
"Status": string,
"ID": string,
"Plan": {
"CommitmentInterval": boolean,
"IsCommitmentPlan": boolean,
"PlanName": string"
},
"RenewalSettings": null,
"Seats": {
"LicensedNumberOfSeats": number,
"MaximumNumberOfSeats": number,
"NumberOfSeats": number
}
},
"settings": null
}
}
Response Body Fields
Field | Description |
---|---|
id | string Subscription id |
type | number Type of the subscription. Can be g-suite , office-365 , google-cloud (billing account), google-cloud-project , amazon-web-services . |
properties.customerDomain | string Primary domain of the subscription. Applicable only for g-suite or office-365 subscriptions. |
properties.customerID | string Internal customer id as referenced by the cloud provider. |
properties.reseller | string Reseller identifier as referenced by the cloud provider. |
properties.subscription.BillingMethod | string Can be ONLINE or OFFLINE . Only online subscriptions can be modified by this API. Offline subscriptions can be modified only by signing a new contract. |
properties.subscription.CreationTime | number When this subscription was created, in milliseconds since epoch. |
'properties.subscription.PurchaseOrderID' | string Purchase number that was used to create this subscription. |
'properties.subscription.ResourceUIURL' | string Admin panel URL for this subscription on cloud provider user interface. |
'properties.subscription.SkuID' | string Cloud provider SKU id for this subscription. |
'properties.subscription.SkuName' | string Cloud provider SKU name for this subscription. |
'properties.subscription.Status' | string Current status of the subscription. Can be either ACTVE or SUSPENDED . |
'properties.subscription.ID' | string Cloud provider unique subscription identifier. |
properties.subscription.Plan.PlanName | part of (Plan ) objectCan be either FLEXIBLE or ANNUAL . only FLEXIBLE subsections can be decreased mid-term (before the renewal date). |
properties.subscriptionSeats object | LicensedNumberOfSeats - how many licenses are available for the domainMaximumNumberOfSeats -NumberOfSeats - |
Updated almost 2 years ago