The Awesome Graphs' REST API gives you the capability to export raw data about commits, lines of code, and pull requests. Using it, you can:

  • Integrate seamlessly with analytics platforms.
  • Build custom graphs.
  • Aggregate and merge data from Bitbucket, and other sources.

Overview

The Awesome Graphs REST API is available beginning with version 5.2.0. You can access the REST API reference documentation at the People page by clicking on Export > REST API or via the link:  <bitbucket-host>/plugins/servlet/graphs-api. If it's not available to you, then you'll need to update the app.

The REST API provides access to resources via URI paths, uses JSON as its communication format, and the standard HTTP methods like GET, PUT, POST and DELETE.

The URIs for resources have the following structure:

https://%bitbucket-host%/rest/awesome-graphs-api/latest/%resource-name%
CODE

For example:

https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits
CODE

Here is the curl command to retrieve the number of commits and lines of code added and deleted in all projects and repositories for the specified period:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/statistics?sinceDate=2020-01-01&untilDate=2020-02-01"
CODE

Below is an example of the response:

{
   "linesOfCode":{
      "added":64590,
      "deleted":34630
   },
   "commits":1230
}
CODE
Question mark (?) introduces the query string parameters. The parameters are separated with an ampersand (&) separating them. The order of the parameters does not matter.

Pagination

Awesome Graphs' REST API uses pagination to improve performance and limit response size of operations that could return a large collection of items.

Commits APIs

Global level

Get commits

GET /rest/awesome-graphs-api/latest/commits

Returns a list of commits from all Bitbucket projects and repositories.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits"
CODE
 Response Samples
 ✔️ 200

Page of commits from all repositories and projects.

{
  "values": [
    {
      "user": {
        "emailAddress": "yorlov@stiltsoft.com",
        "displayName": "Administrator",
        "name": "admin"
      },
      "author": {
        "displayName": "admin",
        "emailAddress": "yorlov@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 1,
        "deleted": 0
      },
      "parents": [],
      "repository": {
        "slug": "Commit Hook",
        "name": "commit-hook",
        "project": {
          "key": "TESTCONTAINERS",
          "name": "Testcontainers",
          "type": "NORMAL"
        }
      },
      "id": "9f2e24a147bb8f5a5a3d10b692703cc5784df8b5"
    },
    {
      "author": {
        "displayName": "avoronova",
        "emailAddress": "avoronova@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 2,
        "deleted": 2
      },
      "parents": [
        {
          "id": "06572e813597bc7d77c8"
        }
      ],
      "repository": {
        "slug": "Awesome Graphs for Bitbucket Server",
        "name": "awesome-graphs-for-bitbucket-server",
        "project": {
          "key": "AWEGRAPHS",
          "name": "Awesome Graphs",
          "type": "NORMAL"
        }
      },
      "id": "295760238d83b84647ae4c10ce16f13fa4d24672"
    }
  ],
  "isLastPage": false,
  "nextPageStart": 2,
  "start": 0,
  "size": 2,
  "limit": 2
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/commits/statistics

Returns the number of commits and lines of code added/deleted in all projects and repositories.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/statistics"
CODE
 Response Samples
 ✔️ 200

Number of commits and lines of code added and deleted.

{
  "linesOfCode": {
    "added": 2061114,
    "deleted": 1917168
  },
  "commits": 7262
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/commits/export/csv

Exports the list of commits with their details from all Bitbucket projects and repositories to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv"
CODE
 Response Samples
 ✔️ 200

 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Project level

Get commits

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/commits

Returns a list of commits from all repositories in the specified project.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/commits"
CODE
 Response Samples
 ✔️ 200

Page of commits from the specified project.

{
  "values": [
    {
      "user": {
        "emailAddress": "yorlov@stiltsoft.com",
        "displayName": "Administrator",
        "name": "admin"
      },
      "author": {
        "displayName": "admin",
        "emailAddress": "yorlov@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 1,
        "deleted": 0
      },
      "parents": [],
      "repository": {
        "slug": "Commit Hook",
        "name": "commit-hook",
        "project": {
          "key": "TESTCONTAINERS",
          "name": "Testcontainers",
          "type": "NORMAL"
        }
      },
      "id": "9f2e24a147bb8f5a5a3d10b692703cc5784df8b5"
    },
    {
      "author": {
        "displayName": "avoronova",
        "emailAddress": "avoronova@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 2,
        "deleted": 2
      },
      "parents": [
        {
          "id": "06572e813597bc7d77c8"
        }
      ],
      "repository": {
        "slug": "Awesome Graphs for Bitbucket Server",
        "name": "awesome-graphs-for-bitbucket-server",
        "project": {
          "key": "AWEGRAPHS",
          "name": "Awesome Graphs",
          "type": "NORMAL"
        }
      },
      "id": "295760238d83b84647ae4c10ce16f13fa4d24672"
    }
  ],
  "isLastPage": false,
  "nextPageStart": 2,
  "start": 0,
  "size": 2,
  "limit": 2
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/commits/statistics

Returns the number of commits and lines of code added/deleted in the specified project.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/commits/statistics"
CODE
 Response Samples
 ✔️ 200

Number of commits and lines of code added and deleted in the specified project.

{
  "linesOfCode": {
    "added": 2061114,
    "deleted": 1917168
  },
  "commits": 7262
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/commits/export/csv

Exports the list of commits with their details from all repositories in the specified project to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/commits/export/csv"
CODE
 Response Samples
 ✔️ 200

 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Repository level

Get commits

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits

Returns a list of commits from the specified repository.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits"
CODE
 Response Samples
 ✔️ 200

Page of commits from the specified repository.

{
  "values": [
    {
      "user": {
        "emailAddress": "yorlov@stiltsoft.com",
        "displayName": "Administrator",
        "name": "admin"
      },
      "author": {
        "displayName": "admin",
        "emailAddress": "yorlov@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 1,
        "deleted": 0
      },
      "parents": [],
      "repository": {
        "slug": "Commit Hook",
        "name": "commit-hook",
        "project": {
          "key": "TESTCONTAINERS",
          "name": "Testcontainers",
          "type": "NORMAL"
        }
      },
      "id": "9f2e24a147bb8f5a5a3d10b692703cc5784df8b5"
    },
    {
      "author": {
        "displayName": "avoronova",
        "emailAddress": "avoronova@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 2,
        "deleted": 2
      },
      "parents": [
        {
          "id": "06572e813597bc7d77c8"
        }
      ],
      "repository": {
        "slug": "Awesome Graphs for Bitbucket Server",
        "name": "awesome-graphs-for-bitbucket-server",
        "project": {
          "key": "AWEGRAPHS",
          "name": "Awesome Graphs",
          "type": "NORMAL"
        }
      },
      "id": "295760238d83b84647ae4c10ce16f13fa4d24672"
    }
  ],
  "isLastPage": false,
  "nextPageStart": 2,
  "start": 0,
  "size": 2,
  "limit": 2
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/statistics

Returns the number of commits and lines of code added/deleted in the specified repository.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/statistics"
CODE
 Response Samples
 ✔️ 200

Number of commits and lines of code added and deleted in the specified repository.

{
  "linesOfCode": {
    "added": 2061114,
    "deleted": 1917168
  },
  "commits": 7262
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/export/csv

Exports the list of commits with their details from the specified repository to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/export/csv"
CODE
 Response Samples
 ✔️ 200

 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Retrieve a single commit

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}

Returns the data of the specified commit identified by its ID.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.
commitIdstringThe hash of a particular commit to get the data of.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}"
CODE
 Response Samples
 ✔️ 200

Data of the specified commit.

{
  "author": {
    "displayName": "avoronova",
    "emailAddress": "avoronova@stiltsoft.com"
  },
  "authorTimestamp": "2020-03-05T22:58:18Z",
  "linesOfCode": {
    "added": 17,
    "deleted": 5
  },
  "parents": [
    {
      "id": "06572e813597bc7d77c8"
    }
  ],
  "repository": {
    "slug": "Awesome Graphs for Bitbucket Server",
    "name": "awesome-graphs-for-bitbucket-server",
    "project": {
      "key": "AWEGRAPHS",
      "name": "Awesome Graphs",
      "type": "NORMAL"
    }
  },
  "id": "9f2e24a147bb8f5a5a3d10b692703cc5784df8b5"
}
CODE
 ❌ 400

Ambiguous short commitId.

{
  "errors": [
    {
      "context": null,
      "message": "Shortened commitId '9fg2fv3r1re' is ambiguous. Enter more characters. The candidates: 9fg2fv3r1re64603bd051a44c6c8728d2e1cec0f, 9fg2fv3r1re104fd3f7170fc80c8e8bacd835681.",
      "exceptionName": "com.stiltsoft.bitbucket.graphs.api.rest.exception.AmbiguousCommitIdException"
    }
  ]
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE
 ❌ 404

Commit not found in the specified repository.

{
  "errors": [
    {
      "context": null,
      "message": "Commit '9f1fs2s4fg6' does not exist in repository 'testcontainers-java'.",
      "exceptionName": "com.atlassian.bitbucket.commit.NoSuchCommitException"
    }
  ]
}
CODE
 ❌ 409

The repository has unindexed changes.

{
  "errors": [
    {
      "context": null,
      "message": "Commit '9f1fs2s4fg6' cannot be found in repository 'testcontainers-java'. The repository has unindexed changes. Try again later.",
      "exceptionName": "com.stiltsoft.bitbucket.graphs.api.rest.exception.RepositoryNotIndexedException"
    }
  ]
}
CODE

User level

Get commits

GET /rest/awesome-graphs-api/latest/users/{userSlug}/commits

Returns a list of commits of a particular user, including commits made by the user's aliases.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/commits"
CODE
 Response Samples
 ✔️ 200

Page of commits of a particular user.

{
  "values": [
    {
      "user": {
        "emailAddress": "yorlov@stiltsoft.com",
        "displayName": "Administrator",
        "name": "admin"
      },
      "author": {
        "displayName": "admin",
        "emailAddress": "yorlov@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 1,
        "deleted": 0
      },
      "parents": [],
      "repository": {
        "slug": "Commit Hook",
        "name": "commit-hook",
        "project": {
          "key": "TESTCONTAINERS",
          "name": "Testcontainers",
          "type": "NORMAL"
        }
      },
      "id": "9f2e24a147bb8f5a5a3d10b692703cc5784df8b5"
    },
    {
      "author": {
        "displayName": "avoronova",
        "emailAddress": "avoronova@stiltsoft.com"
      },
      "authorTimestamp": "2020-03-05T22:58:18Z",
      "linesOfCode": {
        "added": 2,
        "deleted": 2
      },
      "parents": [
        {
          "id": "06572e813597bc7d77c8"
        }
      ],
      "repository": {
        "slug": "Awesome Graphs for Bitbucket Server",
        "name": "awesome-graphs-for-bitbucket-server",
        "project": {
          "key": "AWEGRAPHS",
          "name": "Awesome Graphs",
          "type": "NORMAL"
        }
      },
      "id": "295760238d83b84647ae4c10ce16f13fa4d24672"
    }
  ],
  "isLastPage": false,
  "nextPageStart": 2,
  "start": 0,
  "size": 2,
  "limit": 2
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/users/{userSlug}/commits/statistics

Returns the number of commits and lines of code added/deleted by a particular user.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits, or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/commits/statistics"
CODE
 Response Samples
 ✔️ 200

Number of commits and lines of code added and deleted by a particular user.

{
  "linesOfCode": {
    "added": 2061114,
    "deleted": 1917168
  },
  "commits": 7262
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/users/{userSlug}/commits/export/csv

Exports the list of commits with their details made by a particular user to a CSV file, including commits made by the user's aliases.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

merges

string

If present, controls how merge commits should be filtered. Can be either exclude, to exclude merge commits, include, to include both merge commits and non-merge commits or only, to only return merge commits. Defaults to include.

sinceDate

string

Date in ISO-8601 format to retrieve commits since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve commits until. Example: 1997-07-16T19:20:30+01:00.

order

string

The order to return commits in, either oldest (as in: "oldest first") or newest. Defaults to newest.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/commits/export/csv"
CODE
 Response Samples
 ✔️ 200

 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE


Pull Requests APIs

Global level

Get pull requests

GET /rest/awesome-graphs-api/latest/pull-requests

Returns a list of pull requests from all Bitbucket projects and repositories.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate / untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/pull-requests"
CODE
 Response Samples
 ✔️ 200

Page of pull requests from all repositories and projects.

{
  "values": [
    {
      "links": {
        "self": [
          {
            "href": "http://some-domain.com:23011/projects/facebook/repos/react/pull-requests/2"
          }
        ]
      },
      "participants": [
        {
          "user": {
            "emailAddress": "qa@gmail.com",
            "name": "qa",
            "displayName": "Some QA"
          },
          "approved": false,
          "role": "PARTICIPANT",
          "status": "UNAPPROVED"
        }
      ],
      "title": "16.8.4",
      "toRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "5b766e3564a3453808f3cd3dd3f2e5fad8ef0e7a",
        "displayId": "master",
        "id": "refs/heads/master"
      },
      "fromRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "69a54210d6a9f8f442e0e82a0ce29e034a44aff7",
        "displayId": "16.8.4",
        "id": "refs/heads/16.8.4"
      },
      "author": {
        "user": {
          "emailAddress": "junior@gmail.com",
          "name": "junior",
          "displayName": "Junior Developer"
        },
        "approved": false,
        "role": "AUTHOR",
        "status": "UNAPPROVED"
      },
      "reviewers": [
        {
          "user": {
            "emailAddress": "senior@gmail.com",
            "name": "senior",
            "displayName": "Senior Developer"
          },
          "approved": false,
          "role": "REVIEWER",
          "status": "UNAPPROVED"
        }
      ],
      "createdDate": 1578905403736,
      "updatedDate": 1592905159966,
      "closed": false,
      "locked": false,
      "version": 4,
      "description": "Urgent bugfix",
      "id": 2,
      "state": "OPEN",
      "open": true
    }
  ],
  "isLastPage": true,
  "start": 0,
  "size": 1,
  "limit": 25
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/pull-requests/statistics

Returns the number of pull requests in all projects and repositories.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/pull-requests/statistics"
CODE
 Response Samples
 ✔️ 200

Number of pull requests.

{
  "pullRequests": 16,
  "state": {
    "declined": 5,
    "merged": 7,
    "open": 4
  }
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/pull-requests/export/csv

Exports the list of pull requests with their details from all Bitbucket projects and repositories to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/pull-requests/export/csv"
CODE
 Response Samples
 ✔️ 200


 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Project level

Get pull requests

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests

Returns a list of pull requests from all repositories in the specified project.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate / untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests"
CODE
 Response Samples
 ✔️ 200

Page of pull requests from all repositories and projects.

{
  "values": [
    {
      "links": {
        "self": [
          {
            "href": "http://some-domain.com:23011/projects/facebook/repos/react/pull-requests/2"
          }
        ]
      },
      "participants": [
        {
          "user": {
            "emailAddress": "qa@gmail.com",
            "name": "qa",
            "displayName": "Some QA"
          },
          "approved": false,
          "role": "PARTICIPANT",
          "status": "UNAPPROVED"
        }
      ],
      "title": "16.8.4",
      "toRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "5b766e3564a3453808f3cd3dd3f2e5fad8ef0e7a",
        "displayId": "master",
        "id": "refs/heads/master"
      },
      "fromRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "69a54210d6a9f8f442e0e82a0ce29e034a44aff7",
        "displayId": "16.8.4",
        "id": "refs/heads/16.8.4"
      },
      "author": {
        "user": {
          "emailAddress": "junior@gmail.com",
          "name": "junior",
          "displayName": "Junior Developer"
        },
        "approved": false,
        "role": "AUTHOR",
        "status": "UNAPPROVED"
      },
      "reviewers": [
        {
          "user": {
            "emailAddress": "senior@gmail.com",
            "name": "senior",
            "displayName": "Senior Developer"
          },
          "approved": false,
          "role": "REVIEWER",
          "status": "UNAPPROVED"
        }
      ],
      "createdDate": 1578905403736,
      "updatedDate": 1592905159966,
      "closed": false,
      "locked": false,
      "version": 4,
      "description": "Urgent bugfix",
      "id": 2,
      "state": "OPEN",
      "open": true
    }
  ],
  "isLastPage": true,
  "start": 0,
  "size": 1,
  "limit": 25
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests/statistics

Returns the number of pull requests in the specified project.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests/statistics"
CODE
 Response Samples
 ✔️ 200

Number of pull requests in the specified project.

{
  "pullRequests": 16,
  "state": {
    "declined": 5,
    "merged": 7,
    "open": 4
  }
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests/export/csv

Exports the list of pull requests with their details from all repositories in the specified project to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/pull-requests/export/csv"
CODE
 Response Samples
 ✔️ 200


 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Repository level

Get pull requests

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests

Returns a list of pull requests from the specified repository.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate / untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests"
CODE
 Response Samples
 ✔️ 200

Page of pull requests from the specified repository.

{
  "values": [
    {
      "links": {
        "self": [
          {
            "href": "http://some-domain.com:23011/projects/facebook/repos/react/pull-requests/2"
          }
        ]
      },
      "participants": [
        {
          "user": {
            "emailAddress": "qa@gmail.com",
            "name": "qa",
            "displayName": "Some QA"
          },
          "approved": false,
          "role": "PARTICIPANT",
          "status": "UNAPPROVED"
        }
      ],
      "title": "16.8.4",
      "toRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "5b766e3564a3453808f3cd3dd3f2e5fad8ef0e7a",
        "displayId": "master",
        "id": "refs/heads/master"
      },
      "fromRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "69a54210d6a9f8f442e0e82a0ce29e034a44aff7",
        "displayId": "16.8.4",
        "id": "refs/heads/16.8.4"
      },
      "author": {
        "user": {
          "emailAddress": "junior@gmail.com",
          "name": "junior",
          "displayName": "Junior Developer"
        },
        "approved": false,
        "role": "AUTHOR",
        "status": "UNAPPROVED"
      },
      "reviewers": [
        {
          "user": {
            "emailAddress": "senior@gmail.com",
            "name": "senior",
            "displayName": "Senior Developer"
          },
          "approved": false,
          "role": "REVIEWER",
          "status": "UNAPPROVED"
        }
      ],
      "createdDate": 1578905403736,
      "updatedDate": 1592905159966,
      "closed": false,
      "locked": false,
      "version": 4,
      "description": "Urgent bugfix",
      "id": 2,
      "state": "OPEN",
      "open": true
    }
  ],
  "isLastPage": true,
  "start": 0,
  "size": 1,
  "limit": 25
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/statistics

Returns the number of pull requests in the specified repository.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/statistics"
CODE
 Response Samples
 ✔️ 200

Number of pull requests in the specified repository.

{
  "pullRequests": 16,
  "state": {
    "declined": 5,
    "merged": 7,
    "open": 4
  }
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/export/csv

Exports the list of pull requests with their details from the specified repository to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
projectKeystringThe key of a particular project to retrieve data from.
repositorySlugstringThe slug of a particular repository to retrieve data from.

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/export/csv"
CODE
 Response Samples
 ✔️ 200
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

User level

Get pull requests

GET /rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests

Returns a list of pull requests created by a particular user.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate / untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

startintegerIndicates which item should be used as the first item on the page of results. Defaults to 0.
limitintegerIndicates how many results to return per page. Defaults to 25.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests"
CODE
 Response Samples
 ✔️ 200

Page of pull requests of a particular user.

{
  "values": [
    {
      "links": {
        "self": [
          {
            "href": "http://some-domain.com:23011/projects/facebook/repos/react/pull-requests/2"
          }
        ]
      },
      "participants": [
        {
          "user": {
            "emailAddress": "qa@gmail.com",
            "name": "qa",
            "displayName": "Some QA"
          },
          "approved": false,
          "role": "PARTICIPANT",
          "status": "UNAPPROVED"
        }
      ],
      "title": "16.8.4",
      "toRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "5b766e3564a3453808f3cd3dd3f2e5fad8ef0e7a",
        "displayId": "master",
        "id": "refs/heads/master"
      },
      "fromRef": {
        "repository": {
          "slug": "react",
          "name": "react",
          "project": {
            "key": "FB",
            "name": "facebook",
            "type": "NORMAL"
          }
        },
        "latestCommit": "69a54210d6a9f8f442e0e82a0ce29e034a44aff7",
        "displayId": "16.8.4",
        "id": "refs/heads/16.8.4"
      },
      "author": {
        "user": {
          "emailAddress": "junior@gmail.com",
          "name": "junior",
          "displayName": "Junior Developer"
        },
        "approved": false,
        "role": "AUTHOR",
        "status": "UNAPPROVED"
      },
      "reviewers": [
        {
          "user": {
            "emailAddress": "senior@gmail.com",
            "name": "senior",
            "displayName": "Senior Developer"
          },
          "approved": false,
          "role": "REVIEWER",
          "status": "UNAPPROVED"
        }
      ],
      "createdDate": 1578905403736,
      "updatedDate": 1592905159966,
      "closed": false,
      "locked": false,
      "version": 4,
      "description": "Urgent bugfix",
      "id": 2,
      "state": "OPEN",
      "open": true
    }
  ],
  "isLastPage": true,
  "start": 0,
  "size": 1,
  "limit": 25
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Statistics

GET /rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests/statistics

Returns the number of pull requests created by a particular user.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests/statistics"
CODE
 Response Samples
 ✔️ 200

Number of pull requests created by a particular user.

{
  "pullRequests": 16,
  "state": {
    "declined": 5,
    "merged": 7,
    "open": 4
  }
}
CODE
 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE

Export to CSV

GET /rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests/export/csv

Exports the list of pull requests with their details created by a particular user to a CSV file.

By default, exports the data for the last 30 days. You can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters.

Path Parameters (required)

ParameterValueDescription
userSlugstringURL-friendly version of a username (e.g. 'boomer' instead of 'bøømer', 'boo-mer' instead of 'boo mer').

Query Parameters 

Parameter

Value

Description

state

string

If indicated, only pull requests in the specified state will be returned. Can be either all, open, merged, declined. Defaults to all.

dateTypestringDefines what date type is used for sinceDate untilDate filtering. Can be either created or updated. Defaults to created.

sinceDate

string

Date in ISO-8601 format to retrieve pull requests since. Example: 1997-07-16T19:20:30+01:00.

untilDate

string

Date in ISO-8601 format to retrieve pull requests until. Example: 1997-07-16T19:20:30+01:00.

Request Example

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/users/{userSlug}/pull-requests/export/csv"
CODE
 Response Samples
 ✔️ 200

 ❌ 402

Your Bitbucket instance doesn't have the license allowing to retrieve the requested data.

{
  "errors": [
    {
      "context": null,
      "message": "REST API for Awesome Graphs is available only when you have a commercial or evaluation license for the app. You can buy a license or generate an evaluation license on the Atlassian Marketplace.",
      "exceptionName": null
    }
  ]
}
CODE