Skip to main content
5-Regular Member
December 30, 2015
Solved

Creating Events via the REST API?

  • December 30, 2015
  • 1 reply
  • 1832 views

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.

Best answer by pschmaltz

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.

1 reply

pschmaltz5-Regular MemberAuthorAnswer
5-Regular Member
December 31, 2015

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.