Skip to content

Latest commit

 

History

History
387 lines (246 loc) · 20.4 KB

WebhooksApi.md

File metadata and controls

387 lines (246 loc) · 20.4 KB

{{classname}}

All URIs are relative to https://api.bitbucket.org/2.0

Method HTTP request Description
HookEventsGet Get /hook_events Get a webhook resource
HookEventsSubjectTypeGet Get /hook_events/{subject_type} List subscribable webhook types
RepositoriesWorkspaceRepoSlugHooksGet Get /repositories/{workspace}/{repo_slug}/hooks List webhooks for a repository
RepositoriesWorkspaceRepoSlugHooksPost Post /repositories/{workspace}/{repo_slug}/hooks Create a webhook for a repository
RepositoriesWorkspaceRepoSlugHooksUidDelete Delete /repositories/{workspace}/{repo_slug}/hooks/{uid} Delete a webhook for a repository
RepositoriesWorkspaceRepoSlugHooksUidGet Get /repositories/{workspace}/{repo_slug}/hooks/{uid} Get a webhook for a repository
RepositoriesWorkspaceRepoSlugHooksUidPut Put /repositories/{workspace}/{repo_slug}/hooks/{uid} Update a webhook for a repository
WorkspacesWorkspaceHooksGet Get /workspaces/{workspace}/hooks List webhooks for a workspace
WorkspacesWorkspaceHooksPost Post /workspaces/{workspace}/hooks Create a webhook for a workspace
WorkspacesWorkspaceHooksUidDelete Delete /workspaces/{workspace}/hooks/{uid} Delete a webhook for a workspace
WorkspacesWorkspaceHooksUidGet Get /workspaces/{workspace}/hooks/{uid} Get a webhook for a workspace
WorkspacesWorkspaceHooksUidPut Put /workspaces/{workspace}/hooks/{uid} Update a webhook for a workspace

HookEventsGet

SubjectTypes HookEventsGet(ctx, ) Get a webhook resource

Returns the webhook resource or subject types on which webhooks can be registered. Each resource/subject type contains an events link that returns the paginated list of specific events each individual subject type can emit. This endpoint is publicly accessible and does not require authentication or scopes.

Required Parameters

This endpoint does not need any parameter.

Return type

SubjectTypes

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

HookEventsSubjectTypeGet

PaginatedHookEvents HookEventsSubjectTypeGet(ctx, subjectType, optional) List subscribable webhook types

Returns a paginated list of all valid webhook events for the specified entity. The team and user webhooks are deprecated, and you should use workspace instead. For more information, see the announcement. This is public data that does not require any scopes or authentication. NOTE: The example response is a truncated response object for the workspace subject_type. We return the same structure for the other subject_type objects.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
subjectType string A resource or subject type.
optional *WebhooksApiHookEventsSubjectTypeGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a WebhooksApiHookEventsSubjectTypeGetOpts struct

Name Type Description Notes

page | optional.Int32| page |

Return type

PaginatedHookEvents

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugHooksGet

PaginatedWebhookSubscriptions RepositoriesWorkspaceRepoSlugHooksGet(ctx, repoSlug, workspace, optional) List webhooks for a repository

Returns a paginated list of webhooks installed on this repository.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.
optional *WebhooksApiRepositoriesWorkspaceRepoSlugHooksGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a WebhooksApiRepositoriesWorkspaceRepoSlugHooksGetOpts struct

Name Type Description Notes

page | optional.Int32| page |

Return type

PaginatedWebhookSubscriptions

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugHooksPost

WebhookSubscription RepositoriesWorkspaceRepoSlugHooksPost(ctx, repoSlug, workspace) Create a webhook for a repository

Creates a new webhook on the specified repository. Example: $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo-slug/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"secret\": \"this is a really bad secret\", \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' When the secret is provided it will be used as the key to generate a HMAC digest value sent in the X-Hub-Signature header at delivery time. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. Bitbucket only generates the X-Hub-Signature when the webhook's secret is set. Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: webhook, repository and issue. Also note that the url must properly resolve and cannot be an internal, non-routed address.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugHooksUidDelete

RepositoriesWorkspaceRepoSlugHooksUidDelete(ctx, repoSlug, uid, workspace) Delete a webhook for a repository

Deletes the specified webhook subscription from the given repository.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

(empty response body)

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugHooksUidGet

WebhookSubscription RepositoriesWorkspaceRepoSlugHooksUidGet(ctx, repoSlug, uid, workspace) Get a webhook for a repository

Returns the webhook with the specified id installed on the specified repository.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugHooksUidPut

WebhookSubscription RepositoriesWorkspaceRepoSlugHooksUidPut(ctx, repoSlug, uid, workspace) Update a webhook for a repository

Updates the specified webhook subscription. The following properties can be mutated: * description * url * secret * active * events The hook's secret is used as a key to generate the HMAC hex digest sent in the X-Hub-Signature header at delivery time. This signature is only generated when the hook has a secret. Set the hook's secret by passing the new value in the secret field. Passing a null value in the secret field will remove the secret from the hook. The hook's secret can be left unchanged by not passing the secret field in the request.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WorkspacesWorkspaceHooksGet

PaginatedWebhookSubscriptions WorkspacesWorkspaceHooksGet(ctx, workspace, optional) List webhooks for a workspace

Returns a paginated list of webhooks installed on this workspace.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.
optional *WebhooksApiWorkspacesWorkspaceHooksGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a WebhooksApiWorkspacesWorkspaceHooksGetOpts struct

Name Type Description Notes

page | optional.Int32| page |

Return type

PaginatedWebhookSubscriptions

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WorkspacesWorkspaceHooksPost

WebhookSubscription WorkspacesWorkspaceHooksPost(ctx, workspace) Create a webhook for a workspace

Creates a new webhook on the specified workspace. Workspace webhooks are fired for events from all repositories contained by that workspace. Example: $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/workspaces/my-workspace/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"secret\": \"this is a really bad secret\", \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' When the secret is provided it will be used as the key to generate a HMAC digest value sent in the X-Hub-Signature header at delivery time. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. Bitbucket only generates the X-Hub-Signature when the webhook's secret is set. This call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: webhook, repository and issue. The url must properly resolve and cannot be an internal, non-routed address. Only workspace owners can install webhooks on workspaces.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WorkspacesWorkspaceHooksUidDelete

WorkspacesWorkspaceHooksUidDelete(ctx, uid, workspace) Delete a webhook for a workspace

Deletes the specified webhook subscription from the given workspace.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

(empty response body)

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WorkspacesWorkspaceHooksUidGet

WebhookSubscription WorkspacesWorkspaceHooksUidGet(ctx, uid, workspace) Get a webhook for a workspace

Returns the webhook with the specified id installed on the given workspace.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WorkspacesWorkspaceHooksUidPut

WebhookSubscription WorkspacesWorkspaceHooksUidPut(ctx, uid, workspace) Update a webhook for a workspace

Updates the specified webhook subscription. The following properties can be mutated: * description * url * secret * active * events The hook's secret is used as a key to generate the HMAC hex digest sent in the X-Hub-Signature header at delivery time. This signature is only generated when the hook has a secret. Set the hook's secret by passing the new value in the secret field. Passing a null value in the secret field will remove the secret from the hook. The hook's secret can be left unchanged by not passing the secret field in the request.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
uid string Installed webhook's ID
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

WebhookSubscription

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]