a year ago
How can I retrieve both the reference variable (e.g., ${MySQL.PORT}) and its resolved value (e.g., 8800) from a public API? Currently, the API directly provides the resolved value, but I need both the reference format and the value in the response. How can I achieve this?
4 Replies
a year ago
That's not immediately possible using the API today. What is your use case?
Status changed to Awaiting User Response Railway • over 1 year ago
a year ago
Following up here with a correction; it is indeed possible to get both the unrendered reference variable values and the resolved variable values. Below is a query that will help you achieve that:
query variables($projectId: String!, $environmentId: String!, $pluginId: String, $serviceId: String) {
variables: variables(
projectId: $projectId
environmentId: $environmentId
pluginId: $pluginId
serviceId: $serviceId
)
unrenderedVariables: variables(
projectId: $projectId
environmentId: $environmentId
pluginId: $pluginId
serviceId: $serviceId
unrendered: true
)
}You'd then set your query variables as:
{
"projectId": "<project_id>",
"environmentId": "<env_id>",
"serviceId": "<service_id>"
}Hope this helps.
We'd still love to learn about your use case for using the unrendered reference variables.
Regards,
Christian
christian
Following up here with a correction; it is indeed possible to get both the unrendered reference variable values and the resolved variable values. Below is a query that will help you achieve that: ``` query variables($projectId: String!, $environmentId: String!, $pluginId: String, $serviceId: String) { variables: variables( projectId: $projectId environmentId: $environmentId pluginId: $pluginId serviceId: $serviceId ) unrenderedVariables: variables( projectId: $projectId environmentId: $environmentId pluginId: $pluginId serviceId: $serviceId unrendered: true ) } ``` You'd then set your query variables as: ``` { "projectId": "<project_id>", "environmentId": "<env_id>", "serviceId": "<service_id>" } ``` Hope this helps. We'd still love to learn about your use case for using the unrendered reference variables. Regards, Christian
a year ago
Hi Christian,
Thank you for your response. I’d like to display unrendered reference variables to users when they try to update variables from my website.
Status changed to Awaiting Railway Response Railway • over 1 year ago
Status changed to Awaiting User Response Railway • over 1 year ago
Status changed to Solved christian • over 1 year ago
