GitHub Marketplace用 REST API エンドポイント
REST API を使って GitHub Marketplace を操作する
GitHub Marketplace
について
GitHub Marketplace の詳細については、「GitHub Marketplace」を参照してください。
これらのエンドポイントでは、価格プランを使っている顧客、顧客の購入、アカウントにアクティブなサブスクリプションがあるかどうかを確認できます。
スタブされたエンドポイントでテストする
スタブされたデータを使って、GitHub App をテストすることができます。 スタブされたデータはハードコードされた偽のデータであり、実際のプランに基づいて変更されることはありません。
スタブされたデータでテストするには、対応する本番環境の代わりにスタブされたエンドポイントを使用します。 これにより、GitHub Marketplace で GitHub Apps の一覧を表示する前に、API ロジックが成功するかどうかをテストできます。
GitHub App をデプロイする前に、スタブされたエンドポイントを運用エンドポイントに置き換えてください。
Get a subscription plan for an account
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"Get a subscription plan for an account" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Get a subscription plan for an account" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
account_id integer 必須account_id parameter |
"Get a subscription plan for an account" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
"Get a subscription plan for an account" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/accounts/ACCOUNT_ID
Response
Status: 200
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
List plans
Lists all plans that are part of your GitHub Marketplace listing.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"List plans" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"List plans" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List plans" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
"List plans" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/plans
Response
Status: 200
[
{
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
]
List accounts for a plan
Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"List accounts for a plan" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"List accounts for a plan" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
plan_id integer 必須The unique identifier of the plan. |
名前, Type, 説明 |
---|
sort string The property to sort the results by. Default: 次のいずれかにできます: |
direction string To return the oldest accounts first, set to 次のいずれかにできます: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List accounts for a plan" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
"List accounts for a plan" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/plans/PLAN_ID/accounts
Response
Status: 200
[
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
]
Get a subscription plan for an account (stubbed)
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"Get a subscription plan for an account (stubbed)" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Get a subscription plan for an account (stubbed)" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
account_id integer 必須account_id parameter |
"Get a subscription plan for an account (stubbed)" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
"Get a subscription plan for an account (stubbed)" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/stubbed/accounts/ACCOUNT_ID
Response
Status: 200
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
List plans (stubbed)
Lists all plans that are part of your GitHub Marketplace listing.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"List plans (stubbed)" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"List plans (stubbed)" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List plans (stubbed)" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
"List plans (stubbed)" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/stubbed/plans
Response
Status: 200
[
{
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
]
List accounts for a plan (stubbed)
Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
"List accounts for a plan (stubbed)" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"List accounts for a plan (stubbed)" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
plan_id integer 必須The unique identifier of the plan. |
名前, Type, 説明 |
---|
sort string The property to sort the results by. Default: 次のいずれかにできます: |
direction string To return the oldest accounts first, set to 次のいずれかにできます: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List accounts for a plan (stubbed)" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
401 | Requires authentication |
"List accounts for a plan (stubbed)" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/marketplace_listing/stubbed/plans/PLAN_ID/accounts
Response
Status: 200
[
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
]
List subscriptions for the authenticated user
Lists the active subscriptions for the authenticated user.
"List subscriptions for the authenticated user" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンにはアクセス許可が必要ありません。
"List subscriptions for the authenticated user" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List subscriptions for the authenticated user" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
404 | Resource not found |
"List subscriptions for the authenticated user" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/marketplace_purchases
Response
Status: 200
[
{
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"account": {
"login": "github",
"id": 4,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"email": null,
"organization_billing_email": "billing@github.com",
"type": "Organization"
},
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
]
List subscriptions for the authenticated user (stubbed)
Lists the active subscriptions for the authenticated user.
"List subscriptions for the authenticated user (stubbed)" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンにはアクセス許可が必要ありません。
"List subscriptions for the authenticated user (stubbed)" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"List subscriptions for the authenticated user (stubbed)" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
"List subscriptions for the authenticated user (stubbed)" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/marketplace_purchases/stubbed
Response
Status: 200
[
{
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"account": {
"login": "github",
"id": 4,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"email": null,
"organization_billing_email": "billing@github.com",
"type": "Organization"
},
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
]