Posting a Query from Ignition to Cloud using REST API with Auth


I am trying to post a query to cloud using through REST API every 5 seconds. I am able to post and get the data using postman and I want to do it using Ignition. I evaluated that the best way to do that is by using “timer” in “Gateway events”, and I don’t know how to do it. If someone cloud help with the program or refer to a better way to perform this, that would be great.

Post your current code (obscure any keys) and we can help you convert to jython. What version of Ignition are you using? (It would be best to build around Ignition’s scripting object.)

{When you paste your code into the forum, be sure to re-select it and click the </> button. That will enclose it in a code block to preserve formatting.}

Hello, this is the format I have which runs in the script console and I can read the query using postman. I would like to apply the same query in a timer that runs every 5 seconds. This is the code:

client = 
url = 'my_url' 
token = 'my_token' 
headers = {'authorization':token} 
ID = {
  "valueSource": "Memory",
  "VariableName": "name",
  "VariableValue": 123,
  "tagType": "AtomicTag"
response =, headers, ID)

Also, Can I send the query using the tag id and not specifically naming each tag detail (incase my tag value changes)

So, place that code in project library script. The values that are constant or long-lived would remain un-indented, client and probably token and uri. The rest would be indented within a function def, where the changeable parts are function arguments. Call the function from a gateway timer script. { But consider using a tag change event to omit unnecessary calls, since the source appears to be tag values. }

Sure, you just construct your ID payload with variables instead of constants. The variables could be arguments to the function.