How to run a console command on a Heroku app through their REST API?
Asked Answered
O

1

6

I need to programmatically execute a command on a Heroku app that I created used their REST API. From my console, I'd regularly do it like so:

$ heroku run [command]

I'm looking for a REST API request like this one:

POST /apps/{app_id}/run

But I was unable to find it in on the docs and I just resign to acknowledge that's not implemented. It's too much of a default behavior.

I know I could just install the Heroku Toolbelt on the requester box, but I don't like that. I could also set an authenticated URL to fire the thing but that's also too much of a thing for a feature that's already there!

Orthographize answered 23/1, 2017 at 22:28 Comment(0)
C
8

This is what you're looking for: https://devcenter.heroku.com/articles/platform-api-reference#dyno-create

Notice the example there -- you can specify a run type which will run the process as a one-off thing. This is exactly how the heroku run command works under the hood =)

Cabbala answered 23/1, 2017 at 22:37 Comment(2)
Great! Do you know how to pipe the rendezvous URL?Orthographize
Oh, got it devcenter.heroku.com/articles/…Orthographize

© 2022 - 2025 — McMap. All rights reserved.