Bitbucket Documentation

Index

Skip to end of metadata
Go to start of metadata

The bitbucket 'services' REST endpoint provides functionality for adding, removing, and configuring services (brokers) on your repositories.

Note that this API requires authentication.

Querying Services

$ curl --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/
[
    {
        "id": 3,
        "service": {
            "fields": [
                {
                    "name": "Email",
                    "value": "mcatalbas@atlassian.com"
                }
            ],
            "type": "Email"
        }
    },
    {
        "id": 4,
        "service": {
            "fields": [
                {
                    "name": "URL",
                    "value": "http://example.com/post"
                }
            ],
            "type": "POST"
        }
    }
]

The command above list all services on repository mcatalbas/test.

You can also request a single service attached to your repository:

$ curl --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/4/
[
    {
        "id": 4,
        "service": {
            "fields": [
                {
                    "name": "URL",
                    "value": "http://example.com/post"
                }
            ],
            "type": "POST"
        }
    }
]

Adding Services

To add a new service, issue a POST request:

$ curl --request POST --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/ --data "type=post;URL=http://bitbucket.org/post"
{
    "id": 5,
    "service": {
        "fields": [
            {
                "name": "URL",
                "value": "https://bitbucket.org/post"
            }
        ],
        "type": "POST"
    }
}

The example above shows how to create a new POST service on repository mcatalbas/test. Please note that, only the type of the service is required in the POST data. (Service type is a case-insensitive match.)

All of the service fields that are specific to that service can be supplied, but it is optional. You can update service fields later. (Outlined below.)

Available Services

  • type: POST
    • fields: URL
  • type: FogBugz
    • fields: Repository ID, CVSSubmit URL
  • type: Basecamp
    • fields: Username, Password, Discussion URL
  • type: Lighthouse
    • fields: Project ID, API Key, Subdomain
  • type: CIA.vc
    • fields: Module, Project
  • type: Issues
    • fields: None
  • type: Email
    • fields: Email
  • type: Email Diff
    • fields: Email
  • type: FriendFeed
    • fields: Username, Remote Key, Format
  • type: Rietveld
    • fields: Email, Password, URL
  • type: Superfeedr
    • fields: None
  • type: Geocommit
    • fields: None
  • type: Pivotal Tracker
    • fields: Token

Although you can add Twitter service via API, since it requires three-legged OAuth authentication, you still need to configure it via web interface.

Updating Services

To update a service, issue a PUT request with the ID of the repository service included in the URL:

$ curl --request PUT --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/5/ --data "URL=https://bitbucket.org/new_post"
{
    "id": 5,
    "service": {
        "fields": [
            {
                "name": "URL",
                "value": "https://bitbucket.org/new_post"
            }
        ],
        "type": "POST"
    }
}

Deleting Services

To delete a service, issue a DELETE request:

$ curl --request DELETE --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/5/

Status Codes

200: Ok

On normal successful execution.

401: Unauthorized

Returned if you have not provided your login credentials.

Also returned if you are not one of the administrators of the repository.

404: Not Found

Returned if the resource does not exist.

Labels
  • None