REST Communication with B&R PLC

Hi,
I need to do REST Calls from a B&R PLC to a Server application. Is there a library or a maybe an example code somewhere, where e.g. JSON files can be imported/manipulated and a communication to a REST API is set up?
Another possibility from my point of view would be the usage of AsXml and AsTCP libraries to develop it from scratch, but there might be an easier way I don’t have in mind right now.

Thanks

Hi Franz,

welcome to our Community!

I agree, there would be a way to do it on your own by using for example AsXML or implementing own JSON objects based on string-handling functions (depending on the complexity of your REST service, if the objects are “simple” it’s not that heavy).
In this case I would recommend to have a deeper look inside the AsHTTP library that provides function blocks for setting up own webservices handled via the embedded webserver of Automation Runtime (no need to do it on your own with AsTCP), in your case as I understood you would need to use the HttpClient FB from this library.

The’re also some implementations / functions on Github regarding JSON (some with source code others as binary module only), maybe one of them is useful for you:

Best regards!

1 Like

A post was split to a new topic: Does anyone here have experience using RedFish?