Closed fideloper closed 1 year ago
To get user's organizations, we can make a graphql call - just like getting the user's location.
A sticky point MIGHT be that we need the user's fly token. In theory this is in ~/.fly/config.yml, or via fly auth token.
~/.fly/config.yml
fly auth token
Here's what the GraphQL call looks like tho:
curl \ -H "Authorization: Bearer `fly auth token`" \ -H "Accept: application/json" \ -H "Content-Type: application/json" https://api.fly.io/graphql \ -d '{"query": "query {currentUser {email} organizations {nodes{id slug name type viewerRole}}}"}'
The response looks something like this:
{ "data": { "currentUser": { "email": "fideloper@fly.io" }, "organizations": { "nodes": [ { "id": "xxxyyy", "slug": "personal", "name": "Chris Fidao", "type": "PERSONAL", "viewerRole": "admin" }, { "id": "yyyxxx", "slug": "chipper-ci", "name": "Chipper CI", "type": "SHARED", "viewerRole": "admin" } ] } } }
To get user's organizations, we can make a graphql call - just like getting the user's location.
A sticky point MIGHT be that we need the user's fly token. In theory this is in
~/.fly/config.yml
, or viafly auth token
.Here's what the GraphQL call looks like tho:
The response looks something like this: