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
- fields:
- type:
FogBugz- fields:
Repository ID,CVSSubmit URL
- fields:
- type:
Basecamp- fields:
Username,Password,Discussion URL
- fields:
- type:
Lighthouse- fields:
Project ID,API Key,Subdomain
- fields:
- type:
CIA.vc- fields:
Module,Project
- fields:
- type:
Issues- fields: None
- type:
Email- fields:
Email
- fields:
- type:
Email Diff- fields:
Email
- fields:
- type:
FriendFeed- fields:
Username,Remote Key,Format
- fields:
- type:
Rietveld- fields:
Email,Password,URL
- fields:
- type:
Superfeedr- fields: None
- type:
Geocommit- fields: None
- type:
Pivotal Tracker- fields:
Token
- fields:
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.






Add Comment