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

How do I use the code(SDK) to invoke Thingworx service?

lliangjb
1-Newbie

How do I use the code(SDK) to invoke Thingworx service?

Hello,Everyone!

     I want to use SDK to create many thing in Thingworx,How do use sdk to invoke  service?

     Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
supandey
19-Tanzanite
(To:lliangjb)

Hi Ju Bin, could you please comment more on the use case you have as there are lot of ways with which you can call the services and as we discussed in your other thread How do you batch create things? you have the possibility to call those services available in Resources. Which SDK are you planning to use for your use case?

Best place to begin with, i.e. if you have not yet tried any SDKs would be to check the ThingWorx Edge SDK Help Center​ . For  e.g. if you are looking to begin with Java you can check the API documentation on EntityServices using which you can create needed entities.

Sushant

View solution in original post

4 REPLIES 4
supandey
19-Tanzanite
(To:lliangjb)

Hi Ju Bin, could you please comment more on the use case you have as there are lot of ways with which you can call the services and as we discussed in your other thread How do you batch create things? you have the possibility to call those services available in Resources. Which SDK are you planning to use for your use case?

Best place to begin with, i.e. if you have not yet tried any SDKs would be to check the ThingWorx Edge SDK Help Center​ . For  e.g. if you are looking to begin with Java you can check the API documentation on EntityServices using which you can create needed entities.

Sushant

I'm so sorry,The problem description is not detailed enough,Because my English is not good enough,The documentation is very helpful, thank you!

supandey
19-Tanzanite
(To:lliangjb)

No problem, but I think i got it right anyway glad it helped.

liliu
8-Gravel
(To:lliangjb)

Hi Mr. Guo,

There must be a service on Platform for you to create Things. We just need to call this service from SDK. Invoke service must be used.

Below code is used for invoke service on Java SDK:

//A ValueCollection is used to specify a service's parameters

ValueCollection params = new ValueCollection();

params.put("path", new StringPrimitive("/simple.txt"));

params.put("data", new StringPrimitive("Here is the contents of the file."));

params.put("overwrite", new BooleanPrimitive(true));

// Use the SystemRepository Thing to create a text file on the Platform.

// This service's result type is NOTHING, so we can ignore the response.

client.invokeService(ThingworxEntityTypes.Things, "SystemRepository",

"CreateTextFile", params, 5000);

// If a service does have a result, it is returned within an InfoTable.

params.clear(); // Clear the params used in the previous service invocation.

I suggest you to read Java SDK Developer guide. page 24 is very important. If you still have concern, please let me know.

BR,

Lily

Top Tags