Team ID Miss Match REST vs GraphQL


#1

Hey Team,

Whenever I make REST calls to github for Team, i receive Team ID in number ex: 231536. But when I make call using GraphQL, i get some string MDQ6VGVhbTI0Njk2NDE=.

REST

[
  {
    "name": "Test-1",
    "id": 2530942,
    "slug": "test-1",
    "description": "",
    "privacy": "closed",
    "url": "https://api.github.com/teams/2530942",
    "members_url": "https://api.github.com/teams/2530942/members{/member}",
    "repositories_url": "https://api.github.com/teams/2530942/repos",
    "permission": "pull"
  },
]

GRAPHQL,

"name": "Test-1",
  "id": "MDQ6VGVhbTsdfNjk2NDE="

Unfortunately, i cant use this to make delete calls on teams. Can you please help which field mapping will get me Team ID similar to REST.

Cheers,
Ashish


#2

:wave: Hi @ashishbt82,

In the world of GraphQL, you can use the databaseId field to get the id that’s used in the REST API. On the contrary, in the REST API, there should be a node_id, which you can use in the GraphQL API.

I hope this helps,
Brooks


#3

Thanks @bswinnerton This helps.

Anyways I am converting ID received in graphql (Base 64) i.e. decoding the ID.

Cheers,
Ashish