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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to send data through port 8000 on EMS to platform?

beck.smith
1-Newbie

How to send data through port 8000 on EMS to platform?

New to ThingWorx, have been plowing through the various forums, use cases, and other collateral.

Need a pointer to how to get started with the following:

Have Edge Micro Server installed on Linux machine and have connection to ThingWorx cloud Platform.

Where do I learn, or where are examples, of what and how I push data to port 8000 on the EMS and how I prepare the platform to ingest that data?

I know "it depends" on use case and sensor(s) used and a bunch of other stuff.  For now just want to understand at the level of the web socket (aka port 8000).  I'll get the data moving from my sensor(s) as soon as understand what goes into port 8000 such that the platform can pull it out on the other side.

Just need a starting place, I can do the legwork if given enough context and example.

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions

Beck, quick question - what is the platform version that you are currently using? Primitive_ToJson suggests it's trying to convert something to Json though. I suppose adding a content header should fix it. Please try using this command instead -

curl -X PUT -H "Accept: application/json" -H "Content-Type: application/json" -d "{\"Your_Property_Name\":\"Your_Value\"}" "localhost/Thingworx/Things/Name_of_Thing/Properties/Your_Property_Name?appKey=Your_appKey"

View solution in original post

11 REPLIES 11

Beck, I'm not sure if you checked already, but we have an Edge Help Center which has more information on how the Edge Microserver functions, along with some example configurations, lua functionality etc. Do let me know if you have any questions.

Yes, this is very helpful, Thanks.  I will examine the section regarding the Java SDK to learn more about this method at that level.

I am also seeing references to RESTful API.  Is there a documentation section or examples on preparing the platform to accept GET and PUTs from the EMS?

(Note: If this needs to be in another thread, I will search for and then open same if needed).

Again, just need a pointer to get started, will do the legwork to figure it out once acclimated to the ThingWorx development ecosystem.

Thanks,

The EMS does make REST calls to the platform to send and receive data back and forth. I quite don't understand what you meant by preparing the platform though. All you need from the platform's perspective is a Remote Thing to which you would make a connection using the EMS. The EMS download package contains an example template and some sample scripts. You can use that to add/ bind example properties and services in the platform.

Ok, thanks.  Appreciate your patience as I work through this - will eventually understand.

I thought maybe there was more to do on the platform than just define the remote thing but now that I understand the EMS does the REST call it is starting to make sense.

I'll take a look at the examples in the EMS download zip and go from there.

May post follow-up after I get further along.

Thanks,

No problem, do let me know if you have any questions

In this posting: http://www.davidjmcclelland.com/?p=2743 I found a reference to "ThingWorx provides video tutorials to registered customers that cover REST API" for data operations (see below).  Do you have a pointer to those videos per chance?

 

  1. David J McClellandAugust 12th, 2015 at 9:01 am 3

 

Thanks for your comment I am glad the post was helpful to you. Thingworx provides video tutorials to registered customers that should cover using REST API for CRUD operations. File IO is a more advanced capability worthy of a discussion with support.

 

Thanks,

Here is a link to the video tutorials section in the Help Center.

Thanks for the link, I have worked through the relevant videos and the ThingWorx University training.

Following is the specific problem now countered:

1. Using Thingworx cloud platform and an Edge Microserver instsalled in Linux. Connectivity between EMS and cloud is confirmed per the EMS install guide AND a REST GET call to the thing defined on the platform (see next line) returns its properties - so I know all the components are setup correctly.

2. Have defined thing named labClyde on the cloud platform.

3. Have defined a property for this thing named "x" which is integer.

Now I want to update the value of property x for thing labClyde by using this curl command on linux machine where EMS is installed.

The following curl command results in error on the cloud platform: "2015-10-07 14:17:29,876 SDK: twPrimitive_ToJson: NULL Pointer passed in"

curl -X PUT -d "appKey=436c90cb0-3ef3-48d5-ab18-55d2f7cd3110&value=2" http://localhost:8000/Thingworx/Things/labCLyde/Properties/x

Note: localhost is the host on which the Edge Microserver has been installed.

Can anyone please advise on:

1) What is reason fo the NULL pointer error?

2) What is the REST syntax for updating a property of a thing?

3) What is the correct curl syntax (if answer to number 1 this should become clear).

Thanks,

Beck, quick question - what is the platform version that you are currently using? Primitive_ToJson suggests it's trying to convert something to Json though. I suppose adding a content header should fix it. Please try using this command instead -

curl -X PUT -H "Accept: application/json" -H "Content-Type: application/json" -d "{\"Your_Property_Name\":\"Your_Value\"}" "localhost/Thingworx/Things/Name_of_Thing/Properties/Your_Property_Name?appKey=Your_appKey"

The platform version is 6.5.0-b460

Your suggested syntax did indeed work and I was able to successfully update the property x for the thing labClyde using a POST generated via CURL in Linux.

Thanks for the support!

No problem! Do let us know if you have any questions

Top Tags