POST /v2/local/target-state json format

Hi,
I’m trying to spin up a second instance of a service in a multi service constellation using the supervisor API.
I expect that somehow I will need to use the GET /v2/local/target-state to start from, but when I try to convert that output to the format in the API’s example, I still get errors like:
Expecting number at 7b222a9ae83f879a5c06c897ec93176b.apps.1.0.releases.10ca12e1ea5e.id.0 but instead got: undefined
Expecting string at 7b222a9ae83f879a5c06c897ec93176b.apps.1.0.releases.10ca12e1ea5e.id.1 but instead got: undefined
Are there any (documented) tips to format the input for the POST /v2/local/target-state json format?
Regards,
Bart

Hello @bartjanszoon could you please share your supervisor and CLI versions? I would love to try to reproduce in my machine!

Did you check our docs here? Interacting with the balena Supervisor | balena

@mpous and @bartjanszoon I believe the /v2/local/ endpoints are specifically only usable when running the device in localMode and I don’t think will work as a way to start a duplicate of an existing service. These endpoints were designed primarily to be used by the balena cli to do local push development experience and aren’t currently meant to be used for devices running in production mode where the supervisor target state is set from the cloud. The only current way to replicate a service in your device is to add a duplicate of the service in you docker-compose.yml

@bartjanszoon can you describe your use case and what problem you are trying to solve, perhaps there are better ways to approach this on balena or we can create a feature request for this :smiley:

We have a legacy component that acts as a lambda function and thus has a short (minutes) lifespan. As long as we oncy run one at a time, I can work with the start/stop functions of the Supervisor endpoint, but it would be great if we could run 2 in parallel and give each one a seperate runtime determined service name.