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?

13 Replies

project ID 67325cec-b292-4cb1-a88d-0ac1c6ac5b96


2 years ago

id be happy to help but can you tell me your usecase first?


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


2 years ago

I'm sorry but I don't exactly know what that means, feels like I'm missing some context


Being objective, I wanted to update information in the variable environment through the API, right?


2 years ago

okay, can you share your usecase for that as well?


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.


2 years ago

okay gotcha, thanks for sharing that.

ill get back to you with instructions on how to update a variable for a given service!



2 years 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)
}

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"
    }
  }
}

included is an example variable as to show the syntax needed.

let me know if you have any issues!


Hello


Can you help me again?


Loading...