confusion with API/output/{id}

Get help and insight.
Post Reply
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

confusion with API/output/{id}

Post 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 2802 times
output 8 process editor.jpg
output 8 process editor.jpg (19.38 KiB) Viewed 2802 times
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: confusion with API/output/{id}

Post 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
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Re: confusion with API/output/{id}

Post by bbrally »

Seems obvious when you say it.

Thanks Jon.
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Re: confusion with API/output/{id}

Post 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.
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: confusion with API/output/{id}

Post 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.
Post Reply