[BUG] REST API updateRelease not working

The github REST API for updating a release using a release-id isn’t working

Example taken from here -

curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483

returns

{
  "url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483",
  "assets_url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483/assets",
  "upload_url": "https://uploads.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483/assets{?name,label}",
  "html_url": "https://github.com/subnut/nvim-ghost.nvim/releases/tag/v0.0.33",
  "id": 35728483,
  "author": {
    "login": "github-actions[bot]",
    "id": 41898282,
    "node_id": "MDM6Qm90NDE4OTgyODI=",
    "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-actions%5Bbot%5D",
    "html_url": "https://github.com/apps/github-actions",
    "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
    "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
    "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
    "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
    "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
    "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
    "type": "Bot",
    "site_admin": false
  },
  "node_id": "MDc6UmVsZWFzZTM1NzI4NDgz",
  "tag_name": "v0.0.33",
  "target_commitish": "c6eeeb23ffd89ee7cecddbd414f5fe8a2be02b3a",
  "name": "",
  "draft": false,
  "prerelease": true,
  "created_at": "2020-12-26T11:59:02Z",
  "published_at": "2020-12-26T11:59:57Z",
  "assets": [
    {
      "url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/assets/29988850",
      "id": 29988850,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDI5OTg4ODUw",
      "name": "nvim-ghost-linux.tar.gz",
      "label": "",
      "uploader": {
        "login": "github-actions[bot]",
        "id": 41898282,
        "node_id": "MDM6Qm90NDE4OTgyODI=",
        "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/github-actions%5Bbot%5D",
        "html_url": "https://github.com/apps/github-actions",
        "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
        "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
        "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
        "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
        "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
        "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
        "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
        "type": "Bot",
        "site_admin": false
      },
      "content_type": "application/zip",
      "state": "uploaded",
      "size": 15841828,
      "download_count": 0,
      "created_at": "2020-12-26T12:00:42Z",
      "updated_at": "2020-12-26T12:00:43Z",
      "browser_download_url": "https://github.com/subnut/nvim-ghost.nvim/releases/download/v0.0.33/nvim-ghost-linux.tar.gz"
    },
    {
      "url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/assets/29988846",
      "id": 29988846,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDI5OTg4ODQ2",
      "name": "nvim-ghost-macos.tar.gz",
      "label": "",
      "uploader": {
        "login": "github-actions[bot]",
        "id": 41898282,
        "node_id": "MDM6Qm90NDE4OTgyODI=",
        "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/github-actions%5Bbot%5D",
        "html_url": "https://github.com/apps/github-actions",
        "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
        "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
        "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
        "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
        "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
        "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
        "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
        "type": "Bot",
        "site_admin": false
      },
      "content_type": "application/zip",
      "state": "uploaded",
      "size": 7473323,
      "download_count": 0,
      "created_at": "2020-12-26T12:00:36Z",
      "updated_at": "2020-12-26T12:00:37Z",
      "browser_download_url": "https://github.com/subnut/nvim-ghost.nvim/releases/download/v0.0.33/nvim-ghost-macos.tar.gz"
    },
    {
      "url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/assets/29988858",
      "id": 29988858,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDI5OTg4ODU4",
      "name": "nvim-ghost-win64.zip",
      "label": "",
      "uploader": {
        "login": "github-actions[bot]",
        "id": 41898282,
        "node_id": "MDM6Qm90NDE4OTgyODI=",
        "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/github-actions%5Bbot%5D",
        "html_url": "https://github.com/apps/github-actions",
        "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
        "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
        "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
        "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
        "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
        "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
        "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
        "type": "Bot",
        "site_admin": false
      },
      "content_type": "application/zip",
      "state": "uploaded",
      "size": 8104128,
      "download_count": 0,
      "created_at": "2020-12-26T12:01:30Z",
      "updated_at": "2020-12-26T12:01:31Z",
      "browser_download_url": "https://github.com/subnut/nvim-ghost.nvim/releases/download/v0.0.33/nvim-ghost-win64.zip"
    }
  ],
  "tarball_url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/tarball/v0.0.33",
  "zipball_url": "https://api.github.com/repos/subnut/nvim-ghost.nvim/zipball/v0.0.33",
  "body": ""
}

Which is correct and indicates that the release id 35728483 is valid.

But then,

curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483 \
  -d '{"prerelease":true}

returns

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#update-a-release"
}

When you have my instructions let me know

I edited the original post to include instructions, please check

@subnut

Are you passing your Authorization token in header while calling your request?

If so check wether it has necessary scopes

❯  curl -u "subnut" -i -X PATCH -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/subnut/nvim-ghost.nvim/releases/35728483 -d '{"prerelease":true}'
Enter host password for user 'subnut':
HTTP/1.1 404 Not Found
Date: Thu, 07 Jan 2021 13:48:21 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 117
Server: GitHub.com
Status: 404 Not Found
X-GitHub-Media-Type: github.v3; format=json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1610030901
X-RateLimit-Used: 1
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
Vary: Accept-Encoding, Accept, X-Requested-With
X-GitHub-Request-Id: 8396:1F92:161728F:1C27A09:5FF71125

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#update-a-release"
}

I used the above. I entered my github password where required. Isn’t that enough?

Can you try creating a PAT token with the necessary scopes and check it.

1 Like

@parithiban Thanks! That has finally got it working.

In fact, I just discovered that the username-password method of authentication has been deprecated. Here -