Skip to main content
6-Contributor
February 29, 2024
Solved

how to add service not a dynamic service in a thing via http request?

  • February 29, 2024
  • 1 reply
  • 815 views

In the thingworx plantform we  add service and open developer tool we can see we have send a http request as below,in the body there are a lot of   parameters,

is  there any document show  how to add those parameter?

YC_10946483_0-1709191236244.png

YC_10946483_1-1709191275293.png

 

Best answer by Velkumar

Hi @YC_10946483 

 

You can use the below endpoint to add a service definition 

https://<<HOSTNAME>>/Thingworx/Things/<<THINGNAME>>/Services/AddServiceDefinition 

Method: POST

Body :
{
 name : "servicename",
 description : "Service description",
 category : "",
 parameters : INFOTABLE,
 resultType : INFOTABLE,
 remote : false,
 remoteServiceName : "",
 timeout : 1000
}

This will only create a service definition without any logic inside

 

To create logic refer this article - Solved: Create service programmatically - PTC Community

 

/VR

1 reply

Velkumar19-TanzaniteAnswer
19-Tanzanite
March 1, 2024

Hi @YC_10946483 

 

You can use the below endpoint to add a service definition 

https://<<HOSTNAME>>/Thingworx/Things/<<THINGNAME>>/Services/AddServiceDefinition 

Method: POST

Body :
{
 name : "servicename",
 description : "Service description",
 category : "",
 parameters : INFOTABLE,
 resultType : INFOTABLE,
 remote : false,
 remoteServiceName : "",
 timeout : 1000
}

This will only create a service definition without any logic inside

 

To create logic refer this article - Solved: Create service programmatically - PTC Community

 

/VR

6-Contributor
March 1, 2024

Thanks a lot!