このドキュメントでは、アカウント管理者と販売パートナー管理者が Enterprise License Manager API を使用してユーザー ライセンスの割り当てを管理する方法について説明します。アカウントのサービス SKU ライセンスを有効にしてユーザーを作成したら、Enterprise License Manager API を使用してアカウントのユーザーのライセンスの割り当て、更新、取得、削除を行います。
このバージョンでは、Enterprise License Manager API はアカウント管理者と販売パートナー管理者によって使用されます。License Management
権限を持つ代理管理者は、Enterprise License Manager API を使用することもできます。
注: Enterprise License Manager API は Google のお客様によって使用されています。Google のサードパーティ アプリケーション デベロッパーによるライセンスの管理については、Google Workspace Marketplace API をご覧ください。
Enterprise License Manager API は、ウェブサービスに対する Representational State Transfer(RESTful)設計のアプローチに基づいています。
ライセンスの管理
ライセンスの割り当て
この操作の前に、お客様または販売パートナーが Google プロダクト ライセンスを注文し、ユーザーを作成しました。これらのプロダクト ライセンスのいずれかをこのユーザーに割り当てるには、次の POST
HTTP リクエストを使用します。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。商品 ID と SKU ID については、API で利用可能な商品と SKU をご覧ください。
POST https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user
注: ユーザーには、さまざまな Google サービスのライセンスを割り当てることができます。ただし、ユーザーには、プロダクトごとに一度に 1 つの SKU ライセンスのみが割り当てられます。API を使用すると、ユーザーの SKU ライセンスを再割り当てし、プロダクト内の別の SKU ライセンスに再割り当てできます。
この例では、メインのメールアドレスが alex@example.com であるユーザーに Google-Drive-storage-20 GB SKU を割り当てます。
POST https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user
JSON リクエストの本文:
{ "userId" : "alex@example.com", }
成功すると、200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードを参照してください。成功すると、ライセンス割り当てステータスを JSON データ形式で返します。
JSON レスポンス
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-20GB",
"skuName": "Google Drive storage 20 GB",
"productName": "Google Drive storage"
}
詳しくは、licenseAssignments insert メソッドのリファレンス ページをご覧ください。
同じサービスの別の SKU でユーザーの商品の SKU を再割り当てする
ユーザーのライセンスを同じプロダクト内の新しいライセンス SKU に再割り当てするには、次の PUT
HTTP リクエストを使用します。この API は、パッチ構文もサポートしています。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。商品 ID と SKU ID については、API で利用可能な商品と SKU をご覧ください。
PUT https://www.googleapis.com/apps/licensing/v1/product/productId/sku/the current skuId/user/user's email
この例では、現在の Google-Drive-storage-20 GB の SKU を Google-Drive-storage-50 GB で更新します。現在のライセンス SKU はリクエストの URI にあり、新しいライセンス SKU はリクエストの本文にあります。
PUT https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user/alex@example.com
JSON リクエストの本文には次のものがあります。
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
成功すると、200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードを参照してください。成功すると、ライセンス割り当てステータスが JSON データ形式で返されます。
JSON レスポンス
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
詳細については、licenseAssignments 更新メソッドとパッチメソッドのリファレンス ページをご覧ください。
特定のプロダクトのライセンスが割り当てられているすべてのユーザーを取得する
特定のサービスのすべてのユーザー ライセンスを取得するには、次の GET
HTTP リクエストを使用します。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。customerId
クエリ文字列は、お客様のプライマリ ドメイン名です。maxResults
クエリ文字列は、API 応答で返されるユーザー ライセンス エントリの数を示します。
GET https://www.googleapis.com/apps/licensing/v1/product/productId/users?customerId=primary domain name&maxResults=max results per page
商品 ID と SKU ID については、API で利用可能な商品と SKU をご覧ください。
この例では、example.com ドメインのすべてのユーザーで、Google ドライブ ストレージ サービスのライセンスを割り当てた最初のページを一覧表示します。
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/users?customerId=example.com&maxResults=2
成功すると、200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードを参照してください。成功すると、ライセンス リストが JSON 形式で返されます。
JSON レスポンス
{ "kind" : "licensing#licenseAssignmentList", "etag": "etag value", "nextPageToken" : "the next page token value", "items": [ { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com", "userId": "alex@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-50GB", "skuName": "Google Drive storage 50 GB", "productName": "Google Drive storage" }, { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/keshav@example.com", "userId": "keshav@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, ... }
詳しくは、licenseAssignments listForProduct メソッドのリファレンス ページをご覧ください。
特定のプロダクト SKU のライセンスが割り当てられているすべてのユーザーを取得する
特定のサービス SKU のライセンスを持つすべてのユーザーのリストを取得するには、次の GET
HTTP リクエストを使用します。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。customerId
クエリ文字列は、お客様のプライマリ ドメイン名です。API のレスポンスで返されるユーザー エントリの数は、maxResults
クエリ文字列によって決まります。
GET https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/users?customerId=primary domain name&maxResults=max results per response page
プロダクト ID と SKU ID については、API で利用可能なプロダクトと SKU をご覧ください。
この例では、example.com ドメインのすべてのユーザーのうち、Google-Drive-storage-200 GB SKU のライセンスが割り当てられている最初のページを返します。レスポンスには、ページごとに 2 つのユーザー エントリが一覧表示されます。
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/users?customerId=example.com&maxResults=2
成功すると、200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードを参照してください。成功すると、ライセンス リストが JSON 形式で返されます。
JSON レスポンス
{ "kind" : "licensing#licenseAssignmentList", "etag": "etag value", "nextPageToken" : "next page token's value", "items": [ { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/alex@example.com", "userId": "alex@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/mary@example.com", "userId": "mary@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, ... }
詳しくは、licenseAssignments listForProductAndSku メソッドのリファレンス ページをご覧ください。
サービス SKU で特定のユーザーのライセンスを取得する
サービス SKU で特定のユーザーのライセンスを取得するには、次の GET
HTTP リクエストを使用します。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。商品 ID と SKU ID については、API で利用可能な商品と SKU をご確認ください。
GET https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user/userId
この例では、userId
が alex@example.com であるユーザーの Google ドライブ ストレージの 50 GB のサービス SKU を取得します。
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com
ユーザーがこのライセンスを所有している場合は、正常な応答と 200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードを参照してください。成功すると、ユーザーのライセンスを JSON 形式で返します。
JSON レスポンス
{
"kind": "licensing#licenseAssignment",
"etag": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "keshav@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
詳細については、licenseAssignments get メソッドのリファレンス ページをご覧ください。
ライセンスを削除する
ユーザーからライセンスの割り当てを解除するには、次の DELETE
HTTP リクエストを使用します。リクエストの承認の説明に沿って、Authorization
ヘッダーを含めます。商品 ID と SKU ID については、API で利用可能な商品と SKU をご確認ください。
DELETE https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user/userId
この例では、userId
が alex@example.com であるユーザーの Google-Drive-storage-50 GB ライセンスの割り当てが解除されます。
DELETE https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com
成功すると、200
HTTP ステータス コードが返されます。発生する可能性のあるエラーコードについては、API のエラーコードをご覧ください。
詳しくは、licenseAssignments の delete メソッドのリファレンス ページをご覧ください。
エラーコード
リクエストが失敗した場合、レスポンスにはエラーの簡単な説明が表示されます。
エラーコード | 説明 |
---|---|
400 | 不正なリクエスト - ユーザーのメールアドレスが無効です。 |
400 | 無効なリクエスト - SKU/商品が存在しない |
401 | アクターにはこの API を呼び出すための認証情報がありません。 |
404 | ユーザーにこのライセンスが割り当てられていない場合、レスポンスに「見つかりませんでした」というエラーコードが表示されます。 |
412 | 前提条件が満たされていません。このエラーの詳細については、message フィールドをご覧ください。例:
|
503 | License Manager サービスは利用できません。 |