diff --git a/content/docs/reference/cloud-rest-api/organizations/_index.md b/content/docs/reference/cloud-rest-api/organizations/_index.md index 93d763b26748..3e0fcdb886da 100644 --- a/content/docs/reference/cloud-rest-api/organizations/_index.md +++ b/content/docs/reference/cloud-rest-api/organizations/_index.md @@ -20,7 +20,7 @@ The API provides endpoints for the following categories of operations: - Managing organization members (adding, updating, removing) - Managing organization access tokens - Creating and managing teams -- Managing team access tokens +- Managing team membership, stack permissions, and access tokens ## User Management @@ -396,6 +396,222 @@ curl \ https://api.pulumi.com/api/orgs/{org}/teams/{teamName} ``` +### Grant Stack Access to Team + +Grant a team permissions to access a specific stack. + +```plain +PATCH /api/orgs/{organization}/teams/{team} +``` + +#### Parameters + +| Parameter | Type | In | Description | +|-----------------------------------|---------|--------|----------------------------------------------------------------------------| +| `organization` | string | path | organization name | +| `team` | string | path | team name | +| `addStackPermission` | object | body | object specifying stack and permissions - see following parameters | +| `addStackPermission.projectName` | string | object | project name | +| `addStackPermission.stackName` | string | object | stack name | +| `addStackPermission.permission` | integer | object | number representing stack permissions: 101 (read), 102 (edit), 103 (admin) | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + --request PATCH \ + --data '{"addStackPermission":{"projectName":"{projectName}","stackName":"{stackName}","permission":{permission}}}' \ + https://api.pulumi.com/api/orgs/{organization}/teams/{team} +``` + +#### Default response + +```plain +Status: 204 OK +``` + +```plain +EMPTY RESPONSE BODY +``` + +### Remove Stack Access from Team + +Remove a team's access to a specific stack. + +```plain +PATCH /api/orgs/{organization}/teams/{team} +``` + +#### Parameters + +| Parameter | Type | In | Description | +|----------------------------|--------|--------|--------------------------------------------------------------------| +| `organization` | string | path | organization name | +| `team` | string | path | team name | +| `removeStack` | object | body | object specifying stack and permissions - see following parameters | +| `removeStack.projectName` | string | object | project name | +| `removeStack.stackName` | string | object | stack name | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + --request PATCH \ + --data '{"removeStack":{"projectName":"{projectName}","stackName":"{stackName}"}}' \ + https://api.pulumi.com/api/orgs/{organization}/teams/{team} +``` + +#### Default response + +```plain +Status: 204 OK +``` + +```plain +EMPTY RESPONSE BODY +``` + +## Team Access Tokens + +### List Team Access Tokens + +List all access tokens for a team. + +```plain +GET /api/orgs/{org}/teams/{team}/tokens +``` + +#### Parameters + +| Parameter | Type | In | Description | +|----------------|--------|-------|--------------------------------------------------------------------------------------------| +| `organization` | string | path | organization name | +| `team` | string | path | team name | +| `show_expired` | string | query | **Optional.** whether to return previously expired tokens with results. Defaults to false. | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + https://api.pulumi.com/api/orgs/{org}/teams/{team}/tokens?show_expired=true +``` + +#### Default response + +```plain +Status: 200 OK +``` + +```plain +{ + "tokens": [ + { + "id": "b02514e2-ddf6-41dc-8e16-6abf3914e68f", + "description": "CI/CD token for AI team - Feb 2024", + "expires": 1719333788, + "lastUsed": 1627590233, + "name": "Feb2024CICD-AI" + }, + { + "id": "ad9f7508-493a-4fbe-9918-62f1f71a53f8", + "description": "A team token for the AI team, created in Feb 2023", + "expires": 0, + "lastUsed": 1606860942, + "name": "Feb2023CICD-AI" + } + ] +} +``` + +### Create Team Access Token + +Create a new access token for a team. + +```plain +POST /api/orgs/{org}/teams/{team}/tokens +``` + +#### Parameters + +| Parameter | Type | In | Description | +|----------------|--------|------|------------------------------------------------------------------------------------------------------------------------------------| +| `organization` | string | path | organization name | +| `team` | string | path | team name | +| `description` | string | body | Description of the access token. | +| `name` | string | body | Unique name of the access token, up to 40 characters. Must be unique across the org, including deleted tokens. | +| `expires` | int | body | **Optional.** unix epoch timestamp at which the token should expire, up to two years from present. 0 for no expiry. Defaults to 0. | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + --request POST \ + --data '{"description": "{description}", "name": "{unique_name}", "expires": 0}' \ + https://api.pulumi.com/api/orgs/{org}/teams/{team}/tokens +``` + +#### Default response + +```plain +Status: 204 OK +``` + +```plain +{ + "id": "74529ccd-27c0-40f7-bc4a-589f145ba67f", + "tokenValue": "pul-75a564ac7f3a48079a0c448c1e1ec95c4cfed141" +} +``` + +### Delete Team Access Token + +Delete a team access token. + +```plain +DELETE /api/orgs/{org}/teams/{team}/tokens/{tokenId} +``` + +#### Parameters + +| Parameter | Type | In | Description | +|----------------|--------|------|----------------------| +| `organization` | string | path | organization name | +| `team` | string | path | team name | +| `tokenId` | string | path | the token identifier | + +#### Example + +```bash +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + --request DELETE \ + https://api.pulumi.com/api/orgs/{org}/teams/{team}/tokens/{tokenId} +``` + +#### Default response + +```plain +Status: 204 OK +``` + +```plain +EMPTY RESPONSE BODY +``` + ## Webhooks For comprehensive information about webhooks including setup, configuration, event filtering, and complete API reference, see the [Webhooks documentation](/docs/deployments/webhooks/) and [Webhooks REST API reference](/docs/reference/cloud-rest-api/webhooks/). diff --git a/content/docs/reference/cloud-rest-api/webhooks/_index.md b/content/docs/reference/cloud-rest-api/webhooks/_index.md index 408ec0a81857..3dc23d389c6f 100644 --- a/content/docs/reference/cloud-rest-api/webhooks/_index.md +++ b/content/docs/reference/cloud-rest-api/webhooks/_index.md @@ -24,6 +24,7 @@ The API provides endpoints for the following operations: - Getting webhook details - Updating webhook configuration - Testing webhooks with ping functionality +- Viewing webhook delivery history - Deleting webhooks ## Create Webhook @@ -265,3 +266,65 @@ curl \ --request POST \ https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks/{webhookname}/ping ``` + +## List Webhook Deliveries + +List the delivery history for a webhook, showing details about each webhook invocation including payload, response, and timing information. + +```plain +// List organization webhook deliveries +GET /api/orgs/{organization}/hooks/{webhookname}/deliveries + +// List stack webhook deliveries +GET /api/stacks/{organization}/{project}/{stack}/hooks/{webhookname}/deliveries +``` + +### Parameters + +| Parameter | Type | In | Description | +|----------------|--------|------|--------------------------------------------------------| +| `organization` | string | path | organization name | +| `project` | string | path | project name (only for stack webhooks) | +| `stack` | string | path | stack name (only for stack webhooks) | +| `webhookname` | string | path | webhook name | + +### Example + +```bash +# List organization webhook deliveries +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + https://api.pulumi.com/api/orgs/{organization}/hooks/{webhookname}/deliveries + +# List stack webhook deliveries +curl \ + -H "Accept: application/vnd.pulumi+8" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ + https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks/{webhookname}/deliveries +``` + +### Default response + +```plain +Status: 200 OK +``` + +```plain +[ + { + "id": "ea01abd2-90b4-4670-acce-15cc019ed6e4", + "kind": "ping", + "payload": "{\"timestamp\":1632735487,\"message\":\"🍹 Just a friendly ping from Pulumi 🍹\"}", + "timestamp": 1632735487, + "duration": 196, + "requestUrl": "{webhookurl}", + "requestHeaders": "Content-Type: application/json\r\nPulumi-Webhook-Id: ea01abd2-90b4-4670-acce-15cc019ed6e4\r\nPulumi-Webhook-Kind: ping\r\n", + "responseCode": 200, + "responseHeaders": "{headersfromwebhook}", + "responseBody": "OK" + } +] +```