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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Creating Events via the REST API?

pschmaltz
12-Amethyst

Creating Events via the REST API?

What's the pattern for calling a creating a custom Event on a thing via the REST API? Not clear from the help/documentation what entity type to reference. I'd have thought something like one of these below would work, but I either get errors or nothing:

TIA.

ACCEPTED SOLUTION

Accepted Solutions

Looks like the second of my 3 attempts was in the right direction, but we needed to use POST instead of PUT. 'Events' is a valid entity type just like 'Services'. So something more like this works for us:

curl -X POST -H "Content-Type:application/json" -H "Accept:application/xml" -H "appKey:xxx"https://(instance)/Thingworx/Things/MyThing/Events/CustomEvent -d  '{"data": "xyz"}'


BTW, can anyone point out where further documentation on such things can be found? I'm sure I must be missing something that would readily answer such questions. The online help didn't make any mention of 'Events' as a valid entity type for instance.

View solution in original post

1 REPLY 1

Looks like the second of my 3 attempts was in the right direction, but we needed to use POST instead of PUT. 'Events' is a valid entity type just like 'Services'. So something more like this works for us:

curl -X POST -H "Content-Type:application/json" -H "Accept:application/xml" -H "appKey:xxx"https://(instance)/Thingworx/Things/MyThing/Events/CustomEvent -d  '{"data": "xyz"}'


BTW, can anyone point out where further documentation on such things can be found? I'm sure I must be missing something that would readily answer such questions. The online help didn't make any mention of 'Events' as a valid entity type for instance.

Announcements


Top Tags