How to get environments id?

I'm trying to access this route to get the environment ID, but I'm not having success, could anyone help me?
No description
Solution:
you will need 3 ids for this mutation, environment Id, project Id, and service Id. all three ids can be easily obtained through the command pallet when you have your desired service open - cmd / ctrl + k -> Copy - and you will see an option to copy the ids. ...
Jump to solution
11 Replies
Percy
Percy4d ago
Project ID: 67325cec-b292-4cb1-a88d-0ac1c6ac5b96
kaiomoreira__
kaiomoreira__4d ago
project ID 67325cec-b292-4cb1-a88d-0ac1c6ac5b96
Brody
Brody4d ago
id be happy to help but can you tell me your usecase first?
kaiomoreira__
kaiomoreira__4d ago
I will update the refresh token and access token in the railway env So I needed to get the env id of the project I have
Brody
Brody4d ago
I'm sorry but I don't exactly know what that means, feels like I'm missing some context
kaiomoreira__
kaiomoreira__4d ago
Being objective, I wanted to update information in the variable environment through the API, right?
Brody
Brody4d ago
okay, can you share your usecase for that as well?
kaiomoreira__
kaiomoreira__4d ago
My use case is to update, but I didn't build it because I wanted to have access to this information I'm telling you. But what I can share and even show is the integration with the delivery API and I need to update the access token for this API in the railway project's env. And I started testing through insomnia, I didn't manage to create the complete use case because I'm validating if I can get this project ID environment variable for me to update.
Brody
Brody4d ago
okay gotcha, thanks for sharing that. ill get back to you with instructions on how to update a variable for a given service!
kaiomoreira__
kaiomoreira__4d ago
OK
Solution
Brody
Brody4d ago
you will need 3 ids for this mutation, environment Id, project Id, and service Id. all three ids can be easily obtained through the command pallet when you have your desired service open - cmd / ctrl + k -> Copy - and you will see an option to copy the ids. here is the graphql mutation -
mutation variableCollectionUpsert($input: VariableCollectionUpsertInput!) {
variableCollectionUpsert(input: $input)
}
mutation variableCollectionUpsert($input: VariableCollectionUpsertInput!) {
variableCollectionUpsert(input: $input)
}
and here are the variables needed to go along with that -
{
"input": {
"environmentId": "id_here",
"projectId": "id_here",
"serviceId": "id_here",
"variables": {
"API_KEY": "secret_key_12345"
}
}
}
{
"input": {
"environmentId": "id_here",
"projectId": "id_here",
"serviceId": "id_here",
"variables": {
"API_KEY": "secret_key_12345"
}
}
}
included is an example variable as to show the syntax needed. let me know if you have any issues!