tosqui

Hi all,

I need to use Factory I/O WebAPI in my cybersecurity project, as I would like to automate it by not touching the Factory I/O GUI.

Basically, I have tried and the api only allows me to write values for coils, but I cannot write values for inputs.

 i.e.
---------------------------------------------------------------------------------------------------------------------------
REQUEST
curl -X PUT -d '[{"name": "Start Button 0", "value": true}]' -H "Content-Type: application/json; charset=utf-8" http://127.0.0.1:7410/api/tag/values/by-name

RESPONSE

[{"name": "Start Button 0", "code": 406, "error": "You are not allowed to set the value of an input tag."}]

 ---------------------------------------------------------------------------------------------------------------------------

REQUEST
curl -X PUT -d '[{"name": "Start Button 0 (Light)", "value": 1}]' -H "Content-Type: application/json; charset=utf-8" http://127.0.0.1:7410/api/tag/values/by-name

I'm not at pc and can't remember the answer, but I'm sure the start button light comes on without error.

I think it may be a communication problem between webapi and openplc, but I am not sure and I am looking for someone who has encountered the same problem or something similar.

Reply 0 0
thiagoralves
That’s not how it works. OpenPLC does not communicate through web api. You need to use the Modbus server driver on factory IO and set factory io as a slave device on OpenPLC. After doing that, all factory IOs will be available on OpenPLC address space
Reply 0 0
tosqui

Thanks for your answer, but it is exactly what am doing. 

I think sending a request to change the status of the start button from false to true via API should be the same as click on it in the scene of Factory IO.

Reply 0 0
thiagoralves
That goes beyond OpenPLC scope. You should ask this to the FactoryIO folks
Reply 0 0
Reply