How to use WagoAppHTTP library if never used before

Hi community i am fairly new on this and i thought i would ask some of you a little help.

I am working with an API which allows me to send single https commands via a web page to the achieve the same result as if doing directly in the main application software.

I also use wago PFC for several functions which mostly involve modbus and regular ladder logic programming. Exploring E!cockpit libraries I came across WagoAppHTTP and grow the idea to implement the API functionality within my wago program.

After different attempts on configuring the function block FbHTTPs_GET I have given up as not really capable of understanding how to use it.

My real intention would be to trigger functions on the external software API with FbHTTPs_POST sending my http commands and receive feedback sent out by the API with FbHTTPs_GET

I would need sending 3 different commands and receive 6 different feedback types.

To send{“triggerName”:“D1Unlock”,“deactivateAfterSeconds”:“5”}

To receive

this above is actually something I can write from the external software in plain text and the http command sent is also plain text type. is the API address and is my PFC100

I would need someone to help me configuring the variables necessary for the blocks or even an example of an already configured function block with all needed variables. Something which I can explore to understand what I am doing wrong.

Is here anyone who regularly uses the blocks and knows if I could get the PFC100 to receive and send these commands to then make them variables for my program?

Thanks for you help

Curl or WagoAppHTTP libraries in Codesys do work with REST API’s. Other ways are to use NodeRED for the communications and pass data between NR and C3.5, or do everything in NR. The best option depends on your application requirements.

1 Like

Take a look to this topic : E!cockpit JSON string, sort data - #5 by espenbo

There’s a great example of how to use WagoAppHttp and WagoAppJSON in order to communication with an REST API (here to get electricity prices in Norway).


Ok, lets summarize:

To send request you can use WagoAppHTTP with WagoAppJSON as a JSON parser.
I prefer to send requests with WagoAppHTTP.FbHTTP_Client_Curl.
Btw its better start with Postman and check if requests are ok. There you can find on the right side “Code Snippets” where you can clearly find which part of request should be placed in body and which in header.
If you connect to the linux console, you can test curl requests copied from Postman and check the results.

HTTP server
You can add you webpage with php to /var/www/ and create some php/js functions to pass data to the runtime (file, mqtt, shared memory, modbus, nosql etc). You can do it with PFC100.

With PFC200 you can use Docker containers with NodeRED, NodeJS, Python etc, to create HTTP server and pass requests to runtime.