Trigger a deployment from existing service via Railway Public API

mcioffi
TRIAL

a year 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

a year ago

Do you mind sharing your use case?


mcioffi
TRIAL

a year 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.


a year ago

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


mcioffi
TRIAL

a year ago

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


a year 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
TRIAL

a year ago

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


a year ago

Happy to help


Trigger a deployment from existing service via Railway Public API - Railway Help Station