REST-API-Endpunkte für GitHub Marketplace
Verwende die REST-API, um mit dem GitHub Marketplace zu interagieren.
Informationen zum GitHub Marketplace
Weitere Informationen zu GitHub Marketplace findest du unter GitHub Marketplace.
Anhand dieser Endpunkte kannst du erkennen, welche Kunden einen Preisplan verwenden, du kannst die Käufe eines Kunden anzeigen, und du kannst feststellen, ob ein Konto über ein aktives Abonnement verfügt.
Testen mit Stubendpunkten
Du kannst deine test your GitHub App mit Stubdaten testen. Stubdaten sind hartcodierte Dummydaten, die sich nicht basierend auf tatsächlichen Abonnements ändern.
Verwende zum Testen mit Stubdaten einen Stubendpunkt anstelle des Produktionsendpunkts. Auf diese Weise kannst du testen, ob die API-Logik funktioniert, bevor du GitHub Apps auf dem GitHub Marketplace anbietest.
Ersetze die Stubendpunkte durch Produktionsendpunkte, bevor du deine GitHub App bereitstellst.
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.
Differenzierte Zugriffstoken für "Get a subscription plan for an account"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Get a subscription plan for an account“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
account_id integer Erforderlichaccount_id parameter |
HTTP-Antwortstatuscodes für „Get a subscription plan for an account“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
Codebeispiele für „Get a subscription plan for an account“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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 Enterprise Cloud 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.
Differenzierte Zugriffstoken für "List plans"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „List plans“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List plans“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
Codebeispiele für „List plans“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "List accounts for a plan"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „List accounts for a plan“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
plan_id integer ErforderlichThe unique identifier of the plan. |
Name, type, BESCHREIBUNG |
---|
sort string The property to sort the results by. Standard: Kann eine der Folgenden sein: |
direction string To return the oldest accounts first, set to Kann eine der Folgenden sein: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List accounts for a plan“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „List accounts for a plan“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "Get a subscription plan for an account (stubbed)"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Get a subscription plan for an account (stubbed)“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
account_id integer Erforderlichaccount_id parameter |
HTTP-Antwortstatuscodes für „Get a subscription plan for an account (stubbed)“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
Codebeispiele für „Get a subscription plan for an account (stubbed)“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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 Enterprise Cloud 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.
Differenzierte Zugriffstoken für "List plans (stubbed)"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „List plans (stubbed)“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List plans (stubbed)“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
Codebeispiele für „List plans (stubbed)“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "List accounts for a plan (stubbed)"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „List accounts for a plan (stubbed)“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
plan_id integer ErforderlichThe unique identifier of the plan. |
Name, type, BESCHREIBUNG |
---|
sort string The property to sort the results by. Standard: Kann eine der Folgenden sein: |
direction string To return the oldest accounts first, set to Kann eine der Folgenden sein: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List accounts for a plan (stubbed)“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
401 | Requires authentication |
Codebeispiele für „List accounts for a plan (stubbed)“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "List subscriptions for the authenticated user"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
Das differenzierte Token erfordert keine Berechtigungen.
Parameter für „List subscriptions for the authenticated user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List subscriptions for the authenticated user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
404 | Resource not found |
Codebeispiele für „List subscriptions for the authenticated user“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "List subscriptions for the authenticated user (stubbed)"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
Das differenzierte Token erfordert keine Berechtigungen.
Parameter für „List subscriptions for the authenticated user (stubbed)“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List subscriptions for the authenticated user (stubbed)“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
Codebeispiele für „List subscriptions for the authenticated user (stubbed)“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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"
]
}
}
]