Packages

@octokit/rest

22.0.1 · 31 Oct 2025MIT27.9M / weekRepositoryHomepagenpmAtom feed

Your version

16.0.1

18 Nov 2018Where it was published

16.43.2 is the newest release of 16.x.

In short

10 breaking6 new7 fixed1 changed

  • Breaking

    All previously deprecated methods have been removed

  • Breaking

    Preview headers that are not required to use an API have been removed

  • Breaking

    .gitdata.getTags() has been removed. Use .gitdata.listRefs({namespace: tags}) instead

  • Breaking

    Methods for undocumented endpoints have been removed.

  • Breaking

    octokit.enterprise.* methods have been removed. They have been moved tot the @octokit/enterprise-rest plugin

  • Breaking

    octokit.issues.addLabels sends labels parameter with "labels" namespace instead of sending the array in the request body root. This is not supported by GitHub Enterprise 2.15 or older. You have several options.

  • Breaking

    The milestone parameter is no longer validated using a regex as it cannot be derived from octokit/routes

  • Breaking

    Dropped support for node 4

Release note

To upgrade to v16, make sure you have the latest v15 release installed first:

npm install @octokit/rest@15.18

Now run the tests and look for DEPRECATED messages in the logs. Once you see no more deprecations, upgrading to v16 should cause no problems.

Breaking changes

  • Breaking

    All previously deprecated methods have been removed

  • Breaking

    Preview headers that are not required to use an API have been removed

  • Breaking

    .gitdata.getTags() has been removed. Use .gitdata.listRefs({namespace: tags}) instead

  • Breaking

    Methods for undocumented endpoints have been removed.

    Instead of octokit.users.getById({id}) use octokit.request('GET /user/:id', {id})
    Instead of octokit.repos.getById({id}) use octokit.request('GET /repositories/:id', {id})

  • Breaking

    octokit.enterprise.* methods have been removed. They have been moved tot the @octokit/enterprise-rest plugin

  • Breaking

    octokit.issues.addLabels sends labels parameter with "labels" namespace instead of sending the array in the request body root. This is not supported by GitHub Enterprise 2.15 or older. You have several options.

    1. Use the @octokit/enterprise-compatibility plugin

    2. Use the @octokit/enterprise-rest plugin loading all routes for the GHE version you want to support

    3. Use octokit.request() directly:

    octokit.request('/repos/:owner/:repo/issues/:number/labels', {
      owner,
      repo,
      number,
      data: ['label1', 'label2']
    })
  • Breaking

    The milestone parameter is no longer validated using a regex as it cannot be derived from octokit/routes

  • Breaking

    Dropped support for node 4

  • Breaking

    Error.message is no longer a JSON string containing GitHub’s error message. Instead the JSON is parsed internally and error properties are assigned with its value. This is not technically a breaking change but a bug fix, but as this bug was around for a long time and plenty of apps depend on JSON.parse(error.message) to be working, we treat it as a breaking change by way of precaution

  • Breaking

    error.status is now the response status code number. The status text is no longer returned

Features

Bug Fixes

  • routes: remove validation for milestone parameter as it cannot be derived from octokit/routes

  • Only set preview headers required to use the API

  • Parse JSON from GitHub error messages

Continuous Integration

  • travis: drop tests in node 4 & 9, test in node 10

Bug Fixes in v16.0.1

  • typescript: Adding return types (18ac5bf), closes #1116

  • typescript: Adding the noImplicitAny flag to validate:ts

  • typescript: Github.plugin is a static method, not an instance method

  • typescript: include a header object when transforming Content-Type and Content-Length to headers.content-type and headers.content-length

Thanks @mamodom for your great help with these Typescript fixes 💐

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.