Creating a checkout key with API v2

In my client package, creating a checkout key via the "/project/<repo_slug>/checkout-key" endpoint using the v1.1 API works fine.

Doing the same using API v2 results in a “invalid input” (400) response.

Contrary,

  • getting checkout keys
  • deleting checkout keys

works fine with API v2.

Am I overlooking something?

Hi @pat-s,

I just tried this on my local machine and it worked. Are you passing a "type" value as specified here?

{
  "type": "deploy-key" // or "user-key"
}

I was able to reproduce the “invalid input” response by making the API call without specifying a "type" value.

Thanks. Turns out one has to use user-key with API v2 but github-user-key with API v1.1

When querying the keys, the names are still “github-user-key”. Maybe this should be harmonized upstream to cope with API v2.

2 Likes

Totally @pat-s. Looks like this isn’t specifically called out anywhere either, besides just comparing the V1 and V2 documentation. Harmonizing upstream—and/or just a bullet-point list of changes from 1 to 2 (also not mentioned here or here). Thank you!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.