Page 1 of 1

confusion with API/output/{id}

Posted: Thu Dec 01, 2016 3:05 am
by bbrally
When I post to the api/output/{id} to enable/disable an output I get a result I don't understand.

When I post to set output8 to enable = true, the response is returned that the output is now enabled. But when I go to the process editor and refresh the browser, output8 is still disabled?
If set output8 enabled=false via the API, output8 disappears altogether from the process editor.

Can someone explain what's going on?
output 8 via api swagger docs.jpg
output 8 via api swagger docs.jpg (79.13 KiB) Viewed 2801 times
output 8 process editor.jpg
output 8 process editor.jpg (19.38 KiB) Viewed 2801 times

Re: confusion with API/output/{id}

Posted: Thu Dec 01, 2016 8:36 am
by JonW
bbrally wrote:When I post to the api/output/{id} to enable/disable an output I get a result I don't understand.

When I post to set output8 to enable = true, the response is returned that the output is now enabled. But when I go to the process editor and refresh the browser, output8 is still disabled?
If set output8 enabled=false via the API, output8 disappears altogether from the process editor.

Can someone explain what's going on?
The API call you're using is changing the output at the system level, not the process/state level. It's the equivalent of the "Enabled" checkmark in the BCS "Settings" tab. Your second example causes the output to disappear from the process editor since you are disabling it at the system level.

If you want to enable/disable at the process level, you'll need to use one of the two API's below:
/process/{process_id}/state/{state_id}/output_controllers
/process/{process_id}/state/{state_id}/boolean_outputs

Re: confusion with API/output/{id}

Posted: Thu Dec 01, 2016 2:04 pm
by bbrally
Seems obvious when you say it.

Thanks Jon.

Re: confusion with API/output/{id}

Posted: Thu Dec 01, 2016 3:14 pm
by bbrally
/process/{process_id}/state/{state_id}/output_controllers
/process/{process_id}/state/{state_id}/boolean_outputs

These API's will allow toggling of the output, but they do so by changing the programming of the state.

Is there a way to change the output, but not affect the programming?

What I want to do is change the output regardless of any state running, until a state change takes place and then the program will take priority again to affect the output change. This way if returning to a state, the original programming will be intact.

Re: confusion with API/output/{id}

Posted: Thu Dec 01, 2016 3:23 pm
by JonW
You can use your original call to API/output/{id} and change the "on" state to do that, but program heirarchy may or may not allow the output to be turned on/off.

Using the API to turn the output on is the same as turning it on manually via the main screen of the UI. However, ladder logic or process/state programming may override the ability to do this.

There is no way to turn force an output on via the API when either ladder logic or process/state programming is telling it to be off.