WebDev Module

Hi,

We are needing to provide a JSON API to our Ignition system for our customers. The WebDev seems to be the perfect module for doing this, and after a bit of experimentation, I’m left with a couple of questions…

  1. We would definitely be wanting to limit the rate of the http requests that the customer can make to our gateway for each function we create - how can we do this? Is there a setting I am missing somewhere?

  2. Most of what I want to return is results from a database query (returning as a pydataset). Is there an easy way to convert this pydataset to a list of dictionaries (to then be JSON encoded)? Row by row encoding and concatenation was all I could come up with.

Any help or pointers would be greatly appreciated!! :smiley:

Cheers,
Keiran

Python’s dict() function can accept a list of key,value tuples. I do something like this:pyds = system.db.runPrepQuery(....) headings = pyds.underlyingDataset.columnNames result = [dict(zip(headings, [x for x in row])) for row in pyds]et Voilà, a list of dictionaries.

Phil that is fantastic! Very much appreciated. Hopefully I can figure out this request rate and then this module is all go.

Thanks again,
Keiran