Best way to read/control Swagger UI?

What would I use to read/write to another device that uses Swagger? Node-Red? Do I need to create my own nodes?

Thanks for any advice.
Nick

What is the ‘another device’?

If its an Opto unit, use MMP.
If its not an Opto unit, use Node-RED to do the RESTful call on it.

Not Opto. Is there a training module for RESTful?

Do you want to use PAC Control or Node-RED to do the RESTful call?
We have material on either / both on the forums.

Probably Node-RED. Is there any difference in capability? This will be on an EPIC processor.

Not in capability, just in data handling.
A lot of it depends on what the REST call is going to return. If its just say a float or Int32, then its much a muchness, but if its going to return a string or JSON object, then I would pick Node-RED for sure.

JSON objects are returned. I need to parse and recombine info.

Here is where I start with that sort of thing.
The most simple REST flow.

The inject node for now is a simply manual click to fire.
You can set it for repeat in production or any sort of inject to the http node will do the get, so for example, you could get the JSON data every minute, or when a trigger / event happens, its up to you.

The http request is where the good stuff happens:

  1. You want to get data.
  2. The URL of the RESTful endpoint (can be on the Internet or an IP address of a local service).
  3. You generally don’t want to append the inject node timestamp or anything upstream, so ignore it.
  4. If you need security, things get real interesting real quick.
  5. Hopefully the service you are calling returns a clean JSON object, so select this option and see what you get in the debug tab.
1 Like

Thanks for the starting point! After some searching/digging I actually found a Node for Swagger (now OpenAPI). It works pretty easy actually. Now to figure out how to find what I want and combine it in a useful way…

Wow, that’s really interesting and a Node I had never seen before:


After reviewing it (but not using it), I have no idea what it does… Going to have to a have a play!

Let’s know how you get on and drop a comment on if you get it sorted with this node or the stock http node.

The node is working great, but is there a way to read (write to groov) and entire array at once or does it need to be done one slot at a time?

Also, how do I deal with reading (writing to groov) a dynamic array that varies in size?

I think this is what you want here:

Same with the variable (dynamic) array, just don’t fill out the start or end values, leave them blank, but make sure your groov Data Store is big enough for the max expected array.

1 Like