Pull Requests

GroundControl is capable of connecting to your GitHub repositories through our GitHub app to automatically create pull requests to delete code that's using a specific feature flag. With the REST API you can trigger the creation of a pull request or list the existing pull requests opened for a feature flag.


Endpoints

GET/projects/{projectId}/flags/{flagName}/pulls

List the pull requests for a flag

List the pull requests made for a feature flag

Path parameters

  • Name
    projectId
    Type
    string
    Description
    Required The project id
  • Name
    flagName
    Type
    string
    Description
    Required The flag name

Query parameters

  • Name
    before
    Type
    string
    Description
    Show results before this cursor
  • Name
    after
    Type
    string
    Description
    Show results after this cursor

Request

GET
/projects/{projectId}/flags/{flagName}/pulls
const options = {method: 'GET', headers: {Authorization: 'Bearer YOUR_API_KEY'}};

fetch('https://api.groundcontrol.sh/projects/P091PL4M90ZWQUZ0/flags/my-flag/pulls', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Response

{
  "data": [
    {
      "id": "example",
      "repository": "example",
      "flagName": "example",
      "url": "example",
      "title": "example",
      "status": "example",
      "error": "example",
      "createdAt": "example"
    }
  ],
  "pagination": {
    "before": "YWJjZDEyMzQ1Njc4OTB4eXo=",
    "after": "MTIzNGFiY2RlZmdoaWprbG1ubw=="
  }
}

POST/projects/{projectId}/flags/{flagName}/pulls

Create a pull request

Creates a pull request

Path parameters

  • Name
    projectId
    Type
    string
    Description
    Required The project id
  • Name
    flagName
    Type
    string
    Description
    Required The flag name

Request body

  • Name
    repository
    Type
    string
    Description
    The repository URL

Request

POST
/projects/{projectId}/flags/{flagName}/pulls
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json'},
  body: '{"repository":"example"}'
};

fetch('https://api.groundcontrol.sh/projects/P091PL4M90ZWQUZ0/flags/my-flag/pulls', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Response

{
  "id": "example",
  "repository": "example",
  "flagName": "example",
  "url": "example",
  "title": "example",
  "status": "example",
  "error": "example",
  "createdAt": "example"
}