Error waiting for machine to stop

I’m issuing a GET request to wait for a machine to stop as specified here.

When I do that, however, I get a 400 response (bad request) with the following response body:

  { "error": "instance_id required when waiting for stopped machine" }

Though I think I specified this in the URL in the GET request:

http://_api.internal:4280/v1/apps/MY_APP/machines/SOME_MACHINE_ID/wait?state=stopped&timeout=120

Any idea what I’m doing wrong here?

Thanks for any pointers!

The instance_id is actually different from the machine_id. It represents a specific version of the machine. You can grab that from the machine info, then pass it through as a query param:

http://_api.internal:4280/v1/apps/MY_APP/machines/SOME_MACHINE_ID/wait?state=stopped&timeout=120&instance_id=INSTANCE_ID

ah okay, I wasn’t aware of that.

that part of the docs looks a bit neglected in general, it took me a few steps of try and error to assemble that get request in general…

thanks :pray:

Yeah the Machine API docs are the most minimum MVP right now. We’re focused on making all our infrastructure use machines (instead of Nomad), and then I think we’ll try to make the API a first class experience.

1 Like

incidentally, I recently talked to @Brad about how cool a first class Ruby SDK (aka, API wrapper) would be.

could be modelled after rails-machine-workers/app/models/fly at main · fly-apps/rails-machine-workers · GitHub, for example.

1 Like