cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Read/write tag values in the IoT Gateway REST API server using Postman

JM_10645755
2-Guest

Read/write tag values in the IoT Gateway REST API server using Postman

Hi Folks,

 

I'm a total newbie to Kepware, so please forgive any mistakes or formatting inadequacies. I have searched the website, but answers to similar questions involve ThingWorx, which I'm not using.

 

I'm using a trial version of KepServerEX 6.13 with the Postman utility to test responses to/from a REST API server configured in the IoT Gateway plugin. What I'm asking concerns the JSON call/response values.

 

The IoT Gateway has a REST API agent pointing to a new read/write tag with the name "Channel1.Device1.Order", which is of type string.

 

I followed the example from ptc.com:  https://www.ptc.com/en/support/article/CS376106 . 

 

Here is my POST request:

 

POST            http://127.0.0.1:39320/iotgateway/write

[
    {
        "id""Channel1.Device1.Order",
        "v""000000717087"
    }
]

 

Postman returned this JSON response, along with a status 200:

{
    "writeResults": [
        {
            "id""Channel1.Device1.Order",
            "s"true,
            "r"""
        }
    ]
}
 
I think this response indicates that the tag value was successfully updated.  Let me know if I'm wrong.

 

Now I want to read the current value of the tag I have just updated, but I have no example script. So I tried this:

 

GET    http://127.0.0.1:39320/iotgateway/read?id="Channel1.Device1.Order"

 

Postman response (with status 200):

{
    "readResults": []
}

No errors, but no value either.  Is my GET  request incorrect?  Or did the original POST request fail somehow?  

 

I'd be grateful for any help, and to anyone with the patience to read this far.

 

Cheers

John M.

 

1 ACCEPTED SOLUTION

Accepted Solutions

The format should be
http://127.0.0.1:39320/iotgateway/read?ids=Channel1.Device1.Order

For more details, refer the section "Working with a REST Server" in the IoT Gateway Manual

 

View solution in original post

1 REPLY 1

The format should be
http://127.0.0.1:39320/iotgateway/read?ids=Channel1.Device1.Order

For more details, refer the section "Working with a REST Server" in the IoT Gateway Manual

 

Top Tags