Skip to content

Instantly share code, notes, and snippets.

@tanacasino
Last active March 2, 2018 15:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanacasino/8bbce76bf2c16aea2646 to your computer and use it in GitHub Desktop.
Save tanacasino/8bbce76bf2c16aea2646 to your computer and use it in GitHub Desktop.
GitBucket API Plan

GitBucket API Plan

Goal

Provides GitHub API v3 compatibility and support for popular ecosystem tools.

Steps

  1. Just works with Jenkins GitHub Pull Request Builder Plugin
    • Accelerate Pull Request Driven Development
    • 2014/11
  2. All Repository API
  3. All PullRequest API
  4. All Issues API
  5. All API

1st Goal : Just works with Jenkins

First milestone of GitBucket API

  • Endpoint

    • Jenkins GitHub Pull Request Builder Plugin requires endpoint starts with /api/v3
    • It is GitHub Enterprise endpoint model.
    • So GitBucket API Endpoint starts with /api/v3
  • Access Token

    • User has one Access Token for calling API and authentication
    • User can generate Access Token
    • User can regenerate Access Token
    • User can clear Access Token
  • Access Token Authentication

    • Set request header Authorization: token youraccesstoken
    • EX: curl -i http://localhost:8080/api/v3/user -H "Authorization : token 1234567890"
  • APIs

    1. GET /api/v3/user
      • user infomation
    2. GET /api/v3/rate_limit
      • Not support
      • But returns hard code values
    3. GET /api/v3/repos/:owner/:repo
      • repository infomation
    4. GET /api/v3/repos/:owner/:repo/pulls
      • List pull request
      • Support query : state=open
      • GitHub returns large JSON but GitBucket returns small JSON
    5. GET /api/v3/repos/:owner/:repo/pulls/:pr_issue_id
      • Show pull request
    6. POST /api/v3/repos/:owner/:repo/statuses/:commit_hash_id
      • Set status
    7. POST /api/v3/repos/:owner/:repo/issues/:issue_id/comments
      • Add comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment