Trigger a deployment from existing service via Railway Public API
mcioffi
TRIALOP

2 years ago

Hello, closest I could get to my understanding is in this thread: https://help.railway.app/questions/how-create-service-and-deployment-with-a-fe47580a.

My goal: to trigger a deployment (via the Railway Public graphql API) for an existing service that already has a source connected. Per my understanding, the ServiceConnect graphql endpoint will connect a service to a source which effectively triggers a deploy, but if I already have a source connected, do I just call ServiceConnect regardless? Thanks for any insight!

7 Replies

2 years ago

Do you mind sharing your use case?


mcioffi
TRIALOP

2 years ago

An admin portal (unrelated to Railway, hosted elsewhere) needs to trigger a deploy service that does a one-time fetch for sports datasets on the web (this is the existing Railway service). That Railway service today is run on a Cron schedule, but needs to be triggered manually off-schedule from an administrator.


2 years ago

Why not use the API to trigger the "Run Now" button on the cron service?


mcioffi
TRIALOP

2 years ago

Is the "Run Now" exposed and accessible via the graphql API? Couldn't find anything yet under https://railway.app/graphiql


2 years ago

Simply watch what calls the dashboard makes when you press that button, you may have to use the internal endpoint but that's not an issue given the fact that it accepts the standard account token.


mcioffi
TRIALOP

2 years ago

Ah I c, actually leverages the deploymentRedeploy endpoint which happens to also be available on the public graphql side. Thanks!


2 years ago

Happy to help


Loading...