R
Railway9mo ago
Yash

Is there a railway api for restarting a service?

Hi Folks, Is there an api i can use to trigger a restart for a service? Thanks guys
7 Replies
Percy
Percy9mo ago
Project ID: N/A
Yash
Yash9mo ago
N/A
Yash
Yash9mo ago
i'm not too good at this, any guide on how i can trigger this from my code?
Brody
Brody9mo ago
some tips / info - you would need to use railways public api - it's a graphql api - that's the mutation you would have to use - you'd want to use a graphql client library to make the job easier - that mutation requires a deploymentId input - if your code is restarting itself there is a RAILWAY_DEPLOYMENT_ID environment variable - if your code is restarting a different service you will have to call the deployments query and filter the results by created date and pick the latest successful deployment to restart
Yash
Yash9mo ago
thanks for this man, i'm still figuring how to work this out, but helps
Brody
Brody9mo ago
if you need any more info let me know