Server
Bitbucket Data Center / / Modules

Repository

Postman Collection
OpenAPI
Operations
POST/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branchesDEL/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branchesGET/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/tagsDEL/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}GET/sync/latest/projects/{projectKey}/repos/{repositorySlug}POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronizePUT/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}DEL/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictionsPOST/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictionsGET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}DEL/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}GET/api/latest/profile/recent/reposGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/archiveGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadataGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/branchesPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/branchesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browseGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commitsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/commentsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/commentsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diffGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watchDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commitsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diffGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/filesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scriptsPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/labelsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/labelsDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modifiedGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/patchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activitiesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branchesGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declinePUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declineDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-declineGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooksGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabledDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabledGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settingsPUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settingsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requestsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requestsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tagsPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/tagsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/watchDEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/watchGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooksPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooksPOST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/testGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latestGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statisticsGET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summaryGET/api/latest/repos
POST

Create branch

Creates a branch in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be created.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

empty

boolean

name

string

startPoint

string

Additional Properties

object

Responses

JSON representation of the newly created branch

application/json;charset=UTF-8

RestBranch
POST/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 9 curl --request POST \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json;charset=UTF-8' \ --header 'Content-Type: application/json' \ --data '{ "empty": true, "name": "<string>", "startPoint": "<string>" }'
DEL

Delete branch

Deletes a branch in the specified repository.

If the branch does not exist, this operation will not raise an error. In other words after calling this resource and receiving a 204 response the branch provided in the request is guaranteed to not exist in the specified repository any more, regardless of its existence beforehand.

The optional 'endPoint' parameter of the request may contain a commit ID that the provided ref name is expected to point to. Should the ref point to a different commit ID, a 400 response will be returned with appropriate error details.

The authenticated user must have an effective REPO_WRITE permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be deleted.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

dryRun

boolean

empty

boolean

endPoint

string

name

string

Additional Properties

object

Responses

An empty response indicating that the branch no longer exists in the repository

DEL/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 9 curl --request DELETE \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Content-Type: application/json' \ --data '{ "dryRun": true, "empty": true, "endPoint": "<string>", "name": "<string>" }'
GET

Get branch

Gets the branch information associated with a single commit from a given repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required
commitId

string

Required

Query parameters

limit

integer

start

integer

Responses

a page of branch refs associated with the commit

application/json;charset=UTF-8

PageOfRefs

Page of refs

GET/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}' \ --header 'Accept: application/json;charset=UTF-8'
POST

Create tag

Creates a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The create git tag request.

force

boolean

message

string

name

string

startPoint

string

type

string

Responses

A JSON representation of the newly created tag.

application/json

RestTag
POST/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 4 5 6 7 8 9 10 11 curl --request POST \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "force": true, "message": "A new release tag", "name": "release-tag", "startPoint": "refs/heads/master", "type": "ANNOTATED" }'
201Response
1 2 3 4 5 6 7 8 { "hash": "8d51122def5632836d1cb1026e879069e10a1e13", "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }
DEL

Delete tag

Deletes a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

Request

Path parameters

projectKey

string

Required
name

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the tag no longer exists in the repository.

DEL/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}'
GET

Get synchronization status

Retrieves the synchronization status for the specified repository. In addition to listing refs which cannot be synchronized, if any, the status also provides the timestamp for the most recent synchronization and indicates whether synchronization is available and enabled. If "?at" is specified in the URL, the synchronization status for the specified ref is returned, rather than the complete repository status.

The authenticated user must have REPO_READ permission for the repository, or it must be public if the request is anonymous. Additionally, after synchronization is enabled for a repository, meaning synchronization was available at that time, permission changes and other actions can cause it to become unavailable. Even when synchronization is enabled, if it is no longer available for the repository it will not be performed.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

Synchronization status for the specified repository, or specific ref within that repository.

application/json

RestRefSyncStatus
GET/sync/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 { "orphanedRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "divergedRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "lastSync": 1331038800000, "aheadRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "available": true, "enabled": true }
POST

Disable synchronization

Enables or disables synchronization for the specified repository. When synchronization is enabled, branches within the repository are immediately synchronized and the status is updated with the outcome. That initial synchronization is performed before the REST request returns, allowing it to return the updated status.

The authenticated user must have REPO_ADMIN permission for the specified repository. Anonymous users cannot manage synchronization, even on public repositories. Additionally, synchronization must be available for the specified repository. Synchronization is only available if:

  • The repository is a fork, since its origin is used as upstream
  • The owning user still has access to the fork's origin, if the repository is a personalfork

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

enabled

boolean

Responses

The updated synchronization status for the repository, after enabling synchronization. 204 NO CONTENT is returned instead after disabling synchronization.

application/json

RestRefSyncStatus
POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 { "orphanedRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "divergedRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "lastSync": 1331038800000, "aheadRefs": { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }, "available": true, "enabled": true }
POST

Manual synchronization

Allows developers to apply a manual operation to bring a ref back in sync with upstream when it becomes out of sync due to conflicting changes. The following actions are supported:

  • MERGE: Merges in commits from the upstream ref. After applying this action, the synchronized ref will be AHEAD (as it still includes commits that do not exist upstream.
    • This action is only supported for DIVERGED refs
    • If a "commitMessage" is provided in the context, it will be used on the merge commit. Otherwise a default message is used.
  • DISCARD: Throws away local changes in favour of those made upstream. This is a destructive operation where commits in the local repository are lost.
    • No context entries are supported for this action
    • If the upstream ref has been deleted, the local ref is deleted as well
    • Otherwise, the local ref is updated to reference the same commit as upstream, even if the update is not fast-forward (similar to a forced push)

The authenticated user must have REPO_WRITE permission for the specified repository. Anonymous users cannot synchronize refs, even on public repositories. Additionally, synchronization must be enabled and available for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

action

string

context

Context

refId

string

Responses

The requested action was successfully performed, and has updated the ref's state, but the ref if is still not in sync with upstream. For example, after applying the MERGE action, the ref will still be AHEAD of upstream. If the action brings the ref in sync with upstream, 204 NO CONTENT is returned instead.

application/json

RestRejectedRef
POST/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize
1 2 3 4 5 6 7 8 9 10 11 curl --request POST \ --url 'http://{baseurl}/rest/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "action": "MERGE", "context": { "commitMessage": "Merging in latest from upstream." }, "refId": "refs/heads/master" }'
200Response
1 2 3 4 5 6 7 { "state": "AHEAD", "tag": true, "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }
PUT

React to a comment

Add an emoticon reaction to a comment

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
emoticon

string

Required
repositorySlug

string

Required

Responses

The added reaction

application/json

RestUserReaction
PUT/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 { "emoticon": { "shortcut": "<string>", "url": "<string>", "value": "<string>" }, "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "comment": { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [ { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} } ], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} } }
DEL

Remove a reaction from comment

Remove an emoticon reaction from a comment

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
emoticon

string

Required
repositorySlug

string

Required

Responses

The added reaction

DEL/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}'
GET

Search for ref restrictions

Search for restrictions using the supplied parameters.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

matcherType

string

matcherId

string

type

string

start

number

limit

number

Responses

A response containing a page of restrictions.

application/json

object
GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 { "values": [ { "accessKeys": [ { "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "key": { "algorithmType": "<string>", "bitLength": 2154, "text": "sh-rsa AAAAB3... me@127.0.0.1", "label": "me@127.0.0.1", "id": 1 }, "permission": "USER_ADMIN" } ], "users": [ { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" } ], "groups": [ "group_a", "group_b" ], "scope": { "resourceId": 2, "type": "GLOBAL" }, "matcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 1, "type": "pull-request-only" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create a ref restriction

Create a restriction for the supplied branch or set of branches to be applied on all repositories in the given project.

A restriction means preventing writes on the specified branch(es) by all except a set of users and/or groups, or preventing specific operations such as branch deletion.

For example, you can restrict write access on 'master' to just the 'senior-developer' group, or prevent anyone from deleting that branch.

The request matcher and type must conform to the following.

See the Branch REST API for more information.

  • 'MODEL_BRANCH' represents either the Development or Production branch in the branching model for the project. The 'id' must be one of
    • 'development'
    • 'production'

See the Branch REST API for more information.

  • Type: Set and be one of
      - 'pull-request-only'
    • 'fast-forward-only'
    • 'no-deletes'
    • 'read-only'

    The authenticated user must have PROJECT_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The request containing the details of the restriction to create.

accessKeyIds

array<integer>

accessKeys

array<RestSshAccessKey>

groupNames

array<string>

groups

array<string>

matcher

object

type

string

userSlugs

array<string>

users

array<RestApplicationUser>

Responses

Response contains the ref restriction that was just created.

application/json

RestRefRestriction
POST/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 curl --request POST \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "accessKeyIds": [ 1, 2, 3 ], "accessKeys": [ { "repository": { "scmId": "git", "slug": "my-repo", "project": { "avatarUrl": "<string>", "avatar": "<string>", "key": "PRJ", "links": {} }, "name": "My repo", "links": {} }, "project": { "avatarUrl": "<string>", "avatar": "<string>", "key": "PRJ", "links": {} }, "key": { "algorithmType": "<string>", "bitLength": 2154, "text": "sh-rsa AAAAB3... me@127.0.0.1" }, "permission": "USER_ADMIN" } ], "groupNames": [ "bitbucket-developers" ], "groups": [ "group_a", "group_b" ], "matcher": { "displayId": "main", "id": "refs/heads/main", "type": { "id": "ANY_REF", "name": "Branch" } }, "type": "pull-request-only", "userSlugs": [ "bman", "tstark", "hulk" ], "users": [ { "emailAddress": "jane@example.com", "slug": "jcitizen", "links": {}, "name": "jcitizen", "type": "NORMAL", "active": true, "displayName": "Jane Citizen", "avatarUrl": "<string>" } ] }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 { "accessKeys": [ { "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "key": { "algorithmType": "<string>", "bitLength": 2154, "text": "sh-rsa AAAAB3... me@127.0.0.1", "label": "me@127.0.0.1", "id": 1 }, "permission": "USER_ADMIN" } ], "users": [ { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" } ], "groups": [ "group_a", "group_b" ], "scope": { "resourceId": 2, "type": "GLOBAL" }, "matcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 1, "type": "pull-request-only" }
GET

Get a ref restriction

Returns a restriction as specified by a restriction id.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

A response containing the restriction.

application/json

RestRefRestriction
GET/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 { "accessKeys": [ { "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "key": { "algorithmType": "<string>", "bitLength": 2154, "text": "sh-rsa AAAAB3... me@127.0.0.1", "label": "me@127.0.0.1", "id": 1 }, "permission": "USER_ADMIN" } ], "users": [ { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" } ], "groups": [ "group_a", "group_b" ], "scope": { "resourceId": 2, "type": "GLOBAL" }, "matcher": { "displayId": "main", "id": "refs/heads/main", "type": { "name": "Branch", "id": "ANY_REF" } }, "id": 1, "type": "pull-request-only" }
DEL

Delete a ref restriction

Deletes a restriction as specified by a restriction id.

The authenticated user must have REPO_ADMIN permission or higher to call this resource. Only authenticated users may call this resource.

Request

Path parameters

projectKey

string

Required
id

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the operation was successful

DEL/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}'
GET

Get recently accessed repositories

Retrieve a page of recently accessed repositories for the currently authenticated user.

Repositories are ordered from most recently to least recently accessed.

Only authenticated users may call this resource.

Request

Query parameters

permission

string

start

number

limit

number

Responses

A page of recently accessed repositories.

application/json

object
GET/api/latest/profile/recent/repos
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/profile/recent/repos' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "values": [ { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Stream archive of repository

Streams an archive of the repository's contents at the requested commit. If no at= commit is requested, an archive of the default branch is streamed.

The filename= query parameter may be used to specify the exact filename to include in the "Content-Disposition" header. If an explicit filename is not provided, one will be automatically generated based on what is being archived. Its format depends on the at= value:

Archives may be requested in the following formats by adding the format= query parameter:

  • zip: A zip file using standard compression (Default)
  • tar: An uncompressed tarball
  • tar.gz or tgz: A GZip-compressed tarball

The contents of the archive may be filtered by using the path= query parameter to specify paths to include. path= may be specified multiple times to include multiple paths.

The prefix= query parameter may be used to define a directory (or multiple directories) where the archive's contents should be placed. If the prefix does not end with /, one will be added automatically. The prefix is always treated as a directory; it is not possible to use it to prepend characters to the entries in the archive.

Archives of public repositories may be streamed by any authenticated or anonymous user. Streaming archives for non-public repositories requires an authenticated user with at least REPO_READ permission.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

path

string

filename

string

at

string

prefix

string

format

string

Responses

An archive or the requested commit, in zip, tar or gzipped-tar format.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive' \ --header 'Accept: application/json'
GET

Get an attachment

Retrieve the attachment.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Header parameters

User-Agent

string

Responses

the attachment

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}' \ --header 'Accept: application/json'
DEL

Delete an attachment

Delete an attachment.

The user must be authenticated and have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

This status code has no content.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}'
GET

Get attachment metadata

Retrieve the attachment metadata.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment that has the attachment metadata.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

The attachment metadata

application/json

RestAttachmentMetadata
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 { "metadata": "{\\\"A\\\":\\\"B\\\"}", "url": "test.com/test", "id": 1 }
PUT

Save attachment metadata

Save attachment metadata.

The authenticated user must have REPO_READ permission for the specified repository that is associated to the attachment that has the attachment metadata.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The attachment metadata can be any valid JSON content

string

Responses

The attachment metadata

application/json

any

PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 3 4 5 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '"<string>"'
DEL

Delete attachment metadata

Delete attachment metadata.

The user must be authenticated and have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
attachmentId

string

Required
repositorySlug

string

Required

Responses

This status code has no content.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata'
GET

Find branches

Retrieve the branches matching the supplied filterText param.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

boostMatches

boolean

orderBy

string

details

boolean

filterText

string

base

string

start

number

limit

number

Responses

The branches matching the supplied filterText.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "values": [ { "displayId": "<string>", "default": true, "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "id": "refs/heads/master" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create branch

Creates a branch using the information provided in the RestCreateBranchRequest request

The authenticated user must have REPO_WRITE permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The request to create a branch containing a name, startPoint, and optionally a message

message

string

name

string

startPoint

string

Responses

The created branch.

application/json

RestBranch
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches
1 2 3 4 5 6 7 8 9 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "message": "This is my branch or tag", "name": "my-branch-or-tag", "startPoint": "8d351a10fb428c0c1239530256e21cf24f136e73" }'
200Response
1 2 3 4 5 6 7 { "displayId": "<string>", "default": true, "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "id": "refs/heads/master" }
GET

Get file content at revision

Retrieve a page of content for a file path at a specified revision.

Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent.

  1. size will return a response like {"size":10000}
  2. type will return a response like {"type":"FILE"}, where possible values are "DIRECTORY", "FILE" and "SUBMODULE"
  3. blame without noContent will include blame for the lines of content returned on the page
  4. blame with noContent will omit file contents and only return blame for the requested lines
  5. noContent without blame is ignored and does nothing

The various parameters are "processed" in the above order. That means ?size=true&type=truewill return a size response, not a type one; the type parameter will be ignored.

The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the presence of the parameter implies "true" if no value is specified; size and and type both require an explicit=true or they're treated as "false".

  • ?blame is the same as ?blame=true
  • ?blame&noContent is the same as ?blame=true&noContent=true
  • ?size is the same as ?size=false
  • ?type is the same as ?type=false

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

noContent

string

at

string

size

string

blame

string

type

string

Responses

A page of contents from a file.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse' \ --header 'Accept: application/json'
GET

Get file content

Retrieve a page of content for a file path at a specified revision.

Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent.

  1. size will return a response like {"size":10000}
  2. type will return a response like {"type":"FILE"}, where possible values are "DIRECTORY", "FILE" and "SUBMODULE"
  3. blame without noContent will include blame for the lines of content returned on the page
  4. blame with noContent will omit file contents and only return blame for the requested lines
  5. noContent without blame is ignored and does nothing

The various parameters are "processed" in the above order. That means ?size=true&type=truewill return a size response, not a type one; the type parameter will be ignored.

The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the presence of the parameter implies "true" if no value is specified; size and and type both require an explicit=true or they're treated as "false".

  • ?blame is the same as ?blame=true
  • ?blame&noContent is the same as ?blame=true&noContent=true
  • ?size is the same as ?size=false
  • ?type is the same as ?type=false

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

noContent

string

at

string

size

string

blame

string

type

string

Responses

A page of contents from a file.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}' \ --header 'Accept: application/json'
PUT

Edit file

Update the content of path, on the given repository and branch.

This resource accepts PUT multipart form data, containing the file in a form-field named content.

An example curl request to update 'README.md' would be:

curl -X PUT -u username:password -F content=@README.md -F 'message=Updated using file-edit REST API' -F branch=master -F sourceCommitId=5636641a50b http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md

  • branch: the branch on which the path should be modified or created
  • content: the full content of the file at path
  • message: the message associated with this change, to be used as the commit message. Or null if the default message should be used.
  • sourceCommitId: the commit ID of the file before it was edited, used to identify if content has changed. Or null if this is a new file

The file can be updated or created on a new branch. In this case, the sourceBranch parameter should be provided to identify the starting point for the new branch and the branch parameter identifies the branch to create the new commit on.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Request bodymultipart/form-data

The multipart form data containing the file

branch

string

content

string

message

string

sourceBranch

string

sourceCommitId

string

Responses

The newly created commit.

application/json

RestCommit
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }
GET

Get changes made in commit

Retrieve a page of changes made in a specified commit.

Note: The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

until

string

since

string

start

number

limit

number

Responses

A page of changes

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/changes' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 { "values": [ { "conflict": { "ourChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "theirChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } }, "contentId": "abcdef0123abcdef4567abcdef8987abcdef6543", "fromContentId": "bcdef0123abcdef4567abcdef8987abcdef6543a", "percentUnchanged": 98, "srcExecutable": true, "executable": true, "nodeType": "DIRECTORY", "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get commits

Retrieve a page of commits from a given starting commit or "between" two commits. If no explicit commit is specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

avatarScheme

string

path

string

withCounts

string

followRenames

string

until

string

avatarSize

string

since

string

merges

string

ignoreMissing

string

start

number

Responses

A page of commits

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 { "values": [ { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get commit by ID

Retrieve a single commit identified by its ID. In general, that ID is a SHA1. From 2.11, ref names like "refs/heads/master" are no longer accepted by this resource.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

path

string

Responses

A commit

application/json

RestCommit
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }
GET

Get changes in commit

Retrieve a page of changes made in a specified commit.

Note: The implementation will apply a hard cap (page.max.changes) and it is not possible to request subsequent content when that cap is exceeded.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

withComments

string

since

string

start

number

limit

number

Responses

A page of changes

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 { "values": [ { "conflict": { "ourChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "theirChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } }, "contentId": "abcdef0123abcdef4567abcdef8987abcdef6543", "fromContentId": "bcdef0123abcdef4567abcdef8987abcdef6543a", "percentUnchanged": 98, "srcExecutable": true, "executable": true, "nodeType": "DIRECTORY", "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Search for commit comments

Retrieves the commit discussion comments that match the specified search criteria.

It is possible to retrieve commit discussion comments that are anchored to a range of commits by providing the sinceId that the comments anchored from.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

path

string

since

string

start

number

limit

number

Responses

A page of comments that match the search criteria

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 { "values": [ { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Add a new commit comment

Add a new comment.

Comments can be added in a few places by setting different attributes:

General commit comment:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 "text": "An insightful general comment on a commit." } </pre> Reply to a comment: <pre>{ "text": "A measured reply.", "parent": { "id": 1 } } </pre> General file comment: <pre>{ "text": "An insightful general comment on a file.", "anchor": { "diffType": "COMMIT", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } } </pre> File line comment: <pre>{ "text": "A pithy comment on a particular line within a file.", "anchor": { "diffType": "COMMIT", "line": 1, "lineType": "CONTEXT", "fileType": "FROM", "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd", "path": "path/to/file", "srcPath": "path/to/file", "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b" } }

Note: general file comments are an experimental feature and may change in the near future!

For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on.

For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be:- 'ADDED' - for an added line;- 'REMOVED' - for a removed line; or- 'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff.'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are:- 'FROM' - the source file of the diff- 'TO' - the destination file of the diffIf the current user is not a participant the user is added as one and updated to watch the commit.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

since

string

Request bodyapplication/json

the comment

text

string

id

integer

state

string

version

integer

severity

string

properties

object

Responses

The newly created comment.

application/json

RestComment
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments
1 2 3 4 5 6 7 8 9 10 11 12 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }
GET

Get a commit comment

Retrieves a commit discussion comment.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The requested comment.

application/json

RestComment
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }
PUT

Update a commit comment

Update a comment, with the following restrictions:

  • only the author of the comment may update the text of the comment
  • only the author of the comment or repository admins and above may update the other fields of a comment

Note: the supplied supplied JSON object must contain a version that must match the server's version of the comment or the update will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the returned JSON structure.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The comment to update

text

string

id

integer

state

string

version

integer

severity

string

properties

object

Responses

The newly updated comment.

application/json

RestComment
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 3 4 5 6 7 8 9 10 11 12 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }
DEL

Delete a commit comment

Delete a commit comment. Anyone can delete their own comment. Only users with REPO_ADMIN and above may delete comments created by other users. Comments which have replies may not be deleted, regardless of the user's granted permissions.

The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource.

Request

Path parameters

projectKey

string

Required
commentId

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

version

string

Responses

The operation was successful

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}'
GET

Get api latest projects {projectKey} repos {repositorySlug} commits {commitId} diff

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Query parameters

contextLines

integer

srcPath

string

autoSrcPath

boolean

whitespace

string

withComments

boolean

since

string

Responses

default response

application/json;charset=UTF-8

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff
1 2 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff'
GET

Get diff between revisions

Retrieve the diff between two provided revisions.

Note: This resource is currently not paged. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event that the cap is reached, the diff will be cut short and one or more {@code truncated} flags will be set to true on the "segments", "hunks" and "diffs" properties, as well as the top-level object, in the returned JSON response.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

commitId

string

Required
repositorySlug

string

Required
path

string

Required
projectKey

string

Required

Query parameters

sinceId

string

srcPath

string

avatarSize

string

avatarScheme

string

filter

string

contextLines

string

autoSrcPath

string

whitespace

string

withComments

string

since

string

Responses

A diff between two revisions.

application/json

RestDiff
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 { "lineComments": [ { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "reviewers": [ { "lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998", "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "approved": true, "role": "AUTHOR", "status": "UNAPPROVED" } ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} } ], "truncated": true, "destination": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "hunks": [ { "truncated": true, "sourceLine": 2154, "destinationSpan": 2154, "destinationLine": 2154, "segments": [ { "truncated": true, "lines": [ {} ], "type": "ADDED" } ], "sourceSpan": 2154, "context": "<string>" } ], "source": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "binary": true, "properties": {} }
POST

Watch commit

Add the authenticated user as a watcher for the specified commit.

The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The user is now watching the commit.

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
1 2 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch'
DEL

Stop watching commit

Remove the authenticated user as a watcher for the specified commit.

The authenticated user must have REPO_READ permission for the repository containing the commit to call this resource.

Request

Path parameters

projectKey

string

Required
commitId

string

Required
repositorySlug

string

Required

Responses

The user is no longer watching the commit.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch'
GET

Compare commits

Gets the file changes available in the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

fromRepo

string

from

string

to

string

start

number

limit

number

Responses

A page of changes.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 { "values": [ { "conflict": { "ourChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "theirChange": { "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } }, "contentId": "abcdef0123abcdef4567abcdef8987abcdef6543", "fromContentId": "bcdef0123abcdef4567abcdef8987abcdef6543a", "percentUnchanged": 98, "srcExecutable": true, "executable": true, "nodeType": "DIRECTORY", "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "type": "ADD", "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get accessible commits

Gets the commits accessible from the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

fromRepo

string

from

string

to

string

start

number

limit

number

Responses

A page of commits.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 { "values": [ { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get diff between commits

Gets a diff of the changes available in the from commit but not in the to commit.

If either the from or to commit are not specified, they will be replaced by the default branch of their containing repository.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

fromRepo

string

srcPath

string

from

string

to

string

whitespace

string

start

number

limit

number

Responses

The diff of the changes.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 { "values": [ { "lineComments": [ { "createdDate": 1359075920, "updatedDate": 1449075920, "comments": [], "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ {} ], "reviewers": [ {} ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "parent": { "createdDate": 1359075920, "updatedDate": 1449075920, "anchor": { "diffType": "COMMIT", "fileType": "FROM", "fromHash": "62a0505e8204115b8b9c8a95bfa264a8c0896a93", "lineType": "ADDED", "pullRequest": { "createdDate": 13590759200, "closedDate": 19990759200, "participants": [ {} ], "reviewers": [ {} ], "description": "It is a kludge, but put the tuple from the database in the cache.", "updatedDate": 14490759200, "toRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "fromRef": { "displayId": "feature-ABC-1233", "latestCommit": "babecafebabecafebabecafebabecafebabecafe", "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "id": "refs/heads/feature-ABC-123", "type": "BRANCH" }, "title": "Talking Nerdy", "closed": true, "open": true, "id": 1, "state": "DECLINED", "locked": true, "version": 2154 }, "lineComment": true, "srcPath": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "toHash": "3cdd5d19178a54d2e51b5098d43b57571241d0ab", "line": 98, "path": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" } }, "html": "<string>", "anchored": true, "pending": true, "reply": true, "author": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "text": "An insightful comment.", "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} }, "id": 1, "state": "OPEN", "version": 1, "severity": "NORMAL", "properties": {} } ], "truncated": true, "destination": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "hunks": [ { "truncated": true, "sourceLine": 2154, "destinationSpan": 2154, "destinationLine": 2154, "segments": [ {} ], "sourceSpan": 2154, "context": "<string>" } ], "source": { "components": [ "path", "to", "file.txt" ], "name": "file.txt", "parent": "path/to", "extension": "txt" }, "binary": true, "properties": {} } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get raw diff for path

Stream the raw diff between two provided revisions.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

srcPath

string

until

string

whitespace

string

since

string

Responses

A raw diff between two revisions.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff' \ --header 'Accept: application/json'
GET

Get raw diff for path

Stream the raw diff between two provided revisions.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

contextLines

string

srcPath

string

until

string

whitespace

string

since

string

Responses

A raw diff between two revisions.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}' \ --header 'Accept: application/json'
GET

Get files in directory

Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

start

number

limit

number

Responses

A page of files.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/files' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "values": [], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get files in directory

Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

start

number

limit

number

Responses

A page of files.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "values": [], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get hook scripts

Return a page of hook scripts configured for the specified repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

start

number

limit

number

Responses

A page of hook scripts.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "values": [ { "scope": { "resourceId": 2, "type": "GLOBAL" }, "script": { "createdDate": "<string>", "description": "<string>", "updatedDate": "<string>", "pluginKey": "<string>", "name": "<string>", "id": 2154, "type": "POST", "version": 2154 }, "triggerIds": [ "<string>" ] } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
PUT

Create/update a hook script

Creates/updates the hook script configuration for the provided hook script and repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The hook triggers for which the hook script should be run

triggerIds

array<string>

Responses

The updated hook script.

application/json

RestHookScriptConfig
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}
1 2 3 4 5 6 7 8 9 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "triggerIds": [ "<string>" ] }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "scope": { "resourceId": 2, "type": "GLOBAL" }, "script": { "createdDate": "<string>", "description": "<string>", "updatedDate": "<string>", "pluginKey": "<string>", "name": "<string>", "id": 2154, "type": "POST", "version": 2154 }, "triggerIds": [ "<string>" ] }
DEL

Remove a hook script

Removes the hook script from the set of hook scripts configured to run in the repository.

This endpoint requires REPO_ADMIN permission.

Request

Path parameters

projectKey

string

Required
scriptId

string

Required
repositorySlug

string

Required

Responses

The hook script was successfully deleted.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}'
GET

Get repository labels

Get all labels applied to the given repository.

The authenticated user must have REPO_READ permission for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The applied label.

application/json

RestLabel
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels' \ --header 'Accept: application/json'
200Response
1 2 3 { "name": "labelName" }
POST

Add repository label

Applies a label to the repository.

The authenticated user must have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The label to apply

name

string

Responses

The applied label.

application/json

RestLabel
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels
1 2 3 4 5 6 7 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "labelName" }'
200Response
1 2 3 { "name": "labelName" }
DEL

Remove repository label

Remove label that is applied to the given repository.

The authenticated user must have REPO_ADMIN permission for the specified repository.

Request

Path parameters

projectKey

string

Required
labelName

string

Required
repositorySlug

string

Required

Responses

An empty response indicating that the label is no longer associated to the repository.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}'
GET

Stream files

Streams files from the repository's root with the last commit to modify each file. Commit modifications are traversed starting from the at commit or, if not specified, from the tip of the default branch.

Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

A map of files to the last commit that modified them, and the latest commit to the repository (by nature, any commit to a repository modifies its root).

application/json

ExampleFiles
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 { "files": { "latestCommit": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "readmeMd": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "pomXml": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } } }
GET

Stream files with last modified commit in path

Streams files in the requested path with the last commit to modify each file. Commit modifications are traversed starting from the at commit or, if not specified, from the tip of the default branch.

Unless the repository is public, the authenticated user must have REPO_READ access to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

Responses

A map of files to the last commit that modified them, and the latest commit to update the requested path.

application/json

ExampleFiles
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 { "files": { "latestCommit": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "readmeMd": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" }, "pomXml": { "committerTimestamp": 1449075830, "committer": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "authorTimestamp": 1359075920, "author": { "emailAddress": "charlie@example.com", "name": "Charlie" }, "parents": [ { "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } ], "message": "More work on feature 1", "displayId": "abcdef0", "id": "abcdef0123abcdef4567abcdef8987abcdef6543" } } }
GET

Get patch content at revision

Retrieve the patch content for a repository at a specified revision.

Cache headers are added to the response (only if full commit hashes are used, not in the case of short hashes).

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

until

string

allAncestors

string

since

string

Responses

The patch contents from a repository.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/patch
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/patch' \ --header 'Accept: application/json'
GET

Get raw content of a file at revision

Retrieve the raw content for a file path at a specified revision.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

path

string

Required
projectKey

string

Required
repositorySlug

string

Required

Query parameters

at

string

markup

string

htmlEscape

string

includeHeadingId

string

hardwrap

string

Responses

The raw contents from a file.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}' \ --header 'Accept: application/json'
GET

Get ref change activity

Retrieve a page of repository ref change activity.

The authenticated user must have REPO_ADMIN permission to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

ref

string

start

number

limit

number

Responses

A page of ref change activity.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 { "values": [ { "refChange": { "updatedType": "UNKNOWN", "fromHash": "6053a1eaa1c009dd11092d09a72f3c41af1b59ad", "toHash": "d6edcbf924697ab811a867421dab60d954ccad99", "refId": "refs/heads/master", "type": "ADD", "ref": { "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" } }, "repository": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "trigger": "push", "createdDate": 19990759200, "user": { "emailAddress": "jane@example.com", "slug": "jcitizen", "name": "jcitizen", "id": 101, "type": "NORMAL", "active": true, "displayName": "Jane Citizen" }, "id": 1 } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get branches with ref change activities for repository

Retrieve a page of branches with ref change activities for a specific repository.

The authenticated user must have REPO_ADMIN permission to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

filterText

string

start

number

limit

number

Responses

A page of branches with ref change activities.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "values": [ { "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get auto decline settings

Retrieves the auto decline settings for the supplied repository. Project settings will be returned if no explicit settings have been set for the repository. In the case that there are no project settings, the default settings will be returned.

The authenticated user must have REPO_READ permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The auto decline settings

application/json

RestAutoDeclineSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "inactivityWeeks": 4, "scope": { "resourceId": 2, "type": "GLOBAL" }, "enabled": true }
PUT

Create auto decline settings

Creates or updates the auto decline settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The settings to create or update

enabled

boolean

inactivityWeeks

integer

Responses

The auto decline settings

application/json

RestAutoDeclineSettings
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 3 4 5 6 7 8 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "inactivityWeeks": 4 }'
200Response
1 2 3 4 5 6 7 8 { "inactivityWeeks": 4, "scope": { "resourceId": 2, "type": "GLOBAL" }, "enabled": true }
DEL

Delete auto decline settings

Delete auto decline settings for the supplied repository.

The authenticated user must have REPO_ADMIN permission for this repository to call the resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The auto decline settings have been deleted successfully.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline'
GET

Get api latest projects {projectKey} repos {repositorySlug} settings hooks

Retrieve a page of repository hooks for this repository.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

type

string

start

number

limit

number

Responses

A page of repository hooks with their associated enabled state.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "values": [ { "enabled": true, "scope": { "resourceId": 2, "type": "GLOBAL" }, "details": { "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>", "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>" }, "configured": true } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
GET

Get api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey}

Retrieve a repository hook for this repository.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json

RestRepositoryHook
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "scope": { "resourceId": 2, "type": "GLOBAL" }, "details": { "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>", "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>" }, "configured": true }
DEL

Delete api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey}

Delete repository hook configuration for the supplied hookKey and repositorySlug

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The hook configuration matching the supplied hookKey and repositorySlug was deleted

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}'
PUT

Put api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey} enabled

Enable a repository hook for this repository and optionally apply new configuration.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Header parameters

Content-Length

string

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json

RestRepositoryHook
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "scope": { "resourceId": 2, "type": "GLOBAL" }, "details": { "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>", "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>" }, "configured": true }
DEL

Delete api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey} enabled

Disable a repository hook for this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The repository hooks with their associated enabled state for the supplied hookKey.

application/json

RestRepositoryHook
DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled
1 2 3 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 { "enabled": true, "scope": { "resourceId": 2, "type": "GLOBAL" }, "details": { "configFormKey": "<string>", "supportedScopes": [ "GLOBAL" ], "description": "<string>", "name": "<string>", "key": "<string>", "type": "PRE_RECEIVE", "version": "<string>" }, "configured": true }
GET

Get api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey} settings

Retrieve the settings for a repository hook for this repository.

The authenticated user must have REPO_READ permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Responses

The settings for the hook.

application/json

ExampleSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 { "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648, "stringValue": "This is an arbitrary string" }
PUT

Put api latest projects {projectKey} repos {repositorySlug} settings hooks {hookKey} settings

Modify the settings for a repository hook for this repository.

The service will reject any settings which are too large, the current limit is 32KB once serialized.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook.

Request

Path parameters

projectKey

string

Required
hookKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The raw settings.

booleanValue

boolean

doubleValue

number

integerValue

integer

longValue

integer

stringValue

string

Responses

The settings for the hook.

application/json

ExampleSettings
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings
1 2 3 4 5 6 7 8 9 10 11 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648, "stringValue": "This is an arbitrary string" }'
200Response
1 2 3 4 5 6 7 { "booleanValue": true, "doubleValue": 1.1, "integerValue": 1, "longValue": -2147483648, "stringValue": "This is an arbitrary string" }
GET

Get pull request settings

Retrieve the pull request settings for the context repository.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.

The property keys for the settings that are bundled with the application are

  • mergeConfig - the merge strategy configuration for pull requests
  • requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 if the merge check is disabled
  • com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - the merge check configuration for required approvers
  • requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
  • requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
  • requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 if the merge check is disabled
  • com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - the merge check configuration for required builds

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The repository pull request settings for the context repository.

application/json

RestRepositoryPullRequestSettings
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 { "requiredAllTasksComplete": true, "requiredApproversDeprecated": 2154, "requiredSuccessfulBuilds": { "enabled": true, "count": "3" }, "requiredSuccessfulBuildsDeprecated": 2154, "requiredAllApprovers": true, "requiredApprovers": { "enabled": true, "count": "3" }, "mergeConfig": { "defaultStrategy": { "description": "Always create a merge commit", "flag": "--no-ff", "enabled": true, "name": "Merge commit", "id": "no-ff" }, "strategies": [ { "description": "Always create a merge commit", "flag": "--no-ff", "enabled": true, "name": "Merge commit", "id": "no-ff" } ], "commitSummaries": 2154, "type": "repository" } }
POST

Update pull request settings

Update the pull request settings for the context repository.

The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.

This resource will call all RestFragments that are registered with the key bitbucket.repository.settings.pullRequests. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute.

Only the settings that should be updated need to be included in the request.

The property keys for the settings that are bundled with the application are

  • mergeConfig - the merge strategy configuration for pull requests
  • requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 to disable the merge check
  • com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required approvals)
  • requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable
  • requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable
  • requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 to disable the merge check
  • com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required builds)

Merge strategy configuration deletion:

An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty "mergeConfig" attribute. i.e:

1 2 3 "mergeConfig": { } }

Upon completion of this request, the effective configuration will be:

  • The configuration set for this repository's SCM type as set at the project level, if present, otherwise
  • the configuration set for this repository's SCM type as set at the instance level, if present, otherwise
  • the default configuration for this repository's SCM type

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The updated settings.

requiredAllTasksComplete

boolean

requiredApproversDeprecated

integer

requiredSuccessfulBuilds

object

requiredSuccessfulBuildsDeprecated

integer

requiredAllApprovers

boolean

requiredApprovers

object

mergeConfig

object

Responses

The repository pull request settings for the context repository.

application/json

RestRepositoryPullRequestSettings
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "requiredAllTasksComplete": true, "requiredApproversDeprecated": 2154, "requiredSuccessfulBuilds": { "enabled": true, "count": "3" }, "requiredSuccessfulBuildsDeprecated": 2154, "requiredAllApprovers": true, "requiredApprovers": { "enabled": true, "count": "3" }, "mergeConfig": { "defaultStrategy": { "id": "no-ff", "links": {} }, "strategies": [ { "id": "no-ff", "links": {} } ], "commitSummaries": 2154 } }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 { "requiredAllTasksComplete": true, "requiredApproversDeprecated": 2154, "requiredSuccessfulBuilds": { "enabled": true, "count": "3" }, "requiredSuccessfulBuildsDeprecated": 2154, "requiredAllApprovers": true, "requiredApprovers": { "enabled": true, "count": "3" }, "mergeConfig": { "defaultStrategy": { "description": "Always create a merge commit", "flag": "--no-ff", "enabled": true, "name": "Merge commit", "id": "no-ff" }, "strategies": [ { "description": "Always create a merge commit", "flag": "--no-ff", "enabled": true, "name": "Merge commit", "id": "no-ff" } ], "commitSummaries": 2154, "type": "repository" } }
GET

Find tag

Retrieve the tags matching the supplied filterText param.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

orderBy

string

filterText

string

start

number

limit

number

Responses

The tags matching the supplied filterText.

application/json

object
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "values": [ { "hash": "8d51122def5632836d1cb1026e879069e10a1e13", "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }
POST

Create tag

Creates a tag using the information provided in the RestCreateTagRequest request

The authenticated user must have REPO_WRITE permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The request to create a tag containing a name, startPoint, and optionally a message

message

string

name

string

startPoint

string

Responses

The created tag.

application/json

RestTag
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags
1 2 3 4 5 6 7 8 9 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "message": "This is my branch or tag", "name": "my-branch-or-tag", "startPoint": "8d351a10fb428c0c1239530256e21cf24f136e73" }'
200Response
1 2 3 4 5 6 7 8 { "hash": "8d51122def5632836d1cb1026e879069e10a1e13", "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }
GET

Get tag

Retrieve a tag in the specified repository.

The authenticated user must have REPO_READ permission for the context repository to call this resource.

Request

Path parameters

projectKey

string

Required
name

string

Required
repositorySlug

string

Required

Responses

The tag which matches the supplied name.

application/json

RestTag
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 { "hash": "8d51122def5632836d1cb1026e879069e10a1e13", "latestCommit": "8d51122def5632836d1cb1026e879069e10a1e13", "latestChangeset": "8d51122def5632836d1cb1026e879069e10a1e13", "displayId": "master", "id": "refs/heads/master", "type": "BRANCH" }
POST

Watch repository

Add the authenticated user as a watcher for the specified repository.

The authenticated user must have REPO_READ permission for the repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The repository to watch.

scmId

string

slug

string

project

object

name

string

links

object

Responses

The user is now watching the repository.

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch' \ --header 'Content-Type: application/json' \ --data '{ "scmId": "git", "slug": "my-repo", "project": { "avatarUrl": "<string>", "avatar": "<string>", "key": "PRJ", "links": {} }, "name": "My repo", "links": {} }'
DEL

Stop watching repository

Remove the authenticated user as a watcher for the specified repository.

The authenticated user must have REPO_READ permission for the repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Responses

The user is no longer watching the repository.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch'
GET

Find webhooks

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

event

string

statistics

boolean

Responses

A page of webhooks.

application/json

any

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks' \ --header 'Accept: application/json'
POST

Create webhook

Create a webhook for the repository specified via the URL.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The webhook to be created for this repository.

statistics

object

configuration

object

events

array<string>

active

boolean

url

string

name

string

Responses

A created webhook.

application/json

RestWebhook
POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "statistics": {}, "configuration": {}, "events": [ "<string>" ], "active": true, "url": "<string>", "name": "<string>" }'
200Response
1 2 3 4 5 6 7 8 9 { "configuration": {}, "events": [ "<string>" ], "active": true, "url": "<string>", "name": "<string>" }
POST

Test webhook

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
repositorySlug

string

Required

Query parameters

url

string

Responses

A webhook.

application/json

RestWebhookRequestResponse

POST/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/test
1 2 3 curl --request POST \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/test' \ --header 'Accept: application/json'
GET

Get webhook

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

statistics

string

Responses

A webhook.

application/json

RestWebhook
GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 { "configuration": {}, "events": [ "<string>" ], "active": true, "url": "<string>", "name": "<string>" }
PUT

Put api latest projects {projectKey} repos {repositorySlug} webhooks {webhookId}

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Request bodyapplication/json

The representation of the updated values for the webhook

statistics

object

configuration

object

events

array<string>

active

boolean

url

string

name

string

Responses

A webhook.

application/json

RestWebhook
PUT/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 curl --request PUT \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "statistics": {}, "configuration": {}, "events": [ "<string>" ], "active": true, "url": "<string>", "name": "<string>" }'
200Response
1 2 3 4 5 6 7 8 9 { "configuration": {}, "events": [ "<string>" ], "active": true, "url": "<string>", "name": "<string>" }
DEL

Delete webhook

Delete a webhook for the repository specified via the URL.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Responses

The webhook for the repository has been deleted.

DEL/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}'
GET

Get last webhook invocation details

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

event

string

outcome

string

Responses

A webhook invocation dataset.

application/json

RestDetailedInvocation

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest' \ --header 'Accept: application/json'
GET

Get webhook statistics

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Query parameters

event

string

Responses

A webhook invocation dataset.

application/json

RestInvocationHistory

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics' \ --header 'Accept: application/json'
GET

Get webhook statistics summary

Find webhooks in this repository.

The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.

Request

Path parameters

projectKey

string

Required
webhookId

string

Required
repositorySlug

string

Required

Responses

A webhook invocation dataset.

application/json

RestInvocationHistory

GET/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summary
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/statistics/summary' \ --header 'Accept: application/json'
GET

Search for repositories

Retrieve a page of repositories based on query parameters that control the search. See the documentation of the parameters for more details.

This resource is anonymously accessible.

Note on permissions. In absence of the permission query parameter the implicit 'read' permission is assumed. Please note that this permission is lower than the REPO_READ permission rather than being equal to it. The implicit 'read' permission for a given repository is assigned to any user that has any of the higher permissions, such as REPO_READ, as well as to anonymous users if the repository is marked as public. The important implication of the above is that an anonymous request to this resource with a permission level REPO_READ is guaranteed to receive an empty list of repositories as a result. For anonymous requests it is therefore recommended to not specify the permission parameter at all.

Request

Query parameters

archived

string

projectname

string

projectkey

string

visibility

string

name

string

permission

string

state

string

start

number

limit

number

Responses

A page of repositories.

application/json

object
GET/api/latest/repos
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/repos' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "values": [ { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "origin": { "hierarchyId": "e3c939f9ef4a7fae272e", "statusMessage": "Available", "relatedLinks": {}, "partition": 2154, "defaultBranch": "main", "description": "My repo description", "scmId": "git", "slug": "my-repo", "archived": true, "forkable": true, "project": { "description": "The description for my cool project", "namespace": "<string>", "avatar": "<string>", "scope": "PROJECT", "name": "My Cool Project", "key": "PRJ", "public": true, "id": 2154, "type": "NORMAL" }, "scope": "REPOSITORY", "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" }, "name": "My repo", "public": true, "id": 2154, "state": "AVAILABLE" } ], "size": 1, "isLastPage": true, "nextPageStart": 2154, "start": 2154, "limit": 25 }

Rate this page: