REST Web Services for EMS
REST (Representational State Transfer) is an important communication tool that provides much of the communication functionality that Web Services are used for, but without many of the complexities. As a result, REST is much easier to work with and can be used by any client that is capable of making an HTTP request.
|
The examples in this topic assume that you are familiar with executing HTTP POST methods in your web development environment or application.
|
URL Pattern
The following URL pattern is used when communicating with a ThingWorx Platform:
<http|https>://<host>:<port>/Thingworx/<entity collection>/<entity>/<characteristic collection>/<characteristic>?<query parameters>
You can use this URL pattern when you want to access information that is stored on a ThingWorx Platform for a remote device or machine that is running a WS MES. The pattern to use when you want to access the EMS that is running on a remote device or machine is similar:
<http|https>://<host>:<port>/Thingworx/<entity collection>/<entity>/<characteristic collection>/<characteristic>?<query parameters>
|
Anything enclosed in angle brackets (< >) is information that you may need to provide. Some user-supplied information in the URLs above is required, while some is optional. The information that is required depends on the type of request that is being made.
|
The following REST Web Service call executes the service GetLogData that is associated with the Thing called ACMElocking_valve.
http://localhost/Thingworx/Things/ACMElocking_valve/Services/GetLogData
{
"startDate": 1572566400,
"endDate": 1572652800,
"maxItems: 50
}
The REST method is GET for this example. To view the returned data in JSON format, select the value application-json for the Accept Header in the REST client.
Built-in Collection Values
The ThingWorx Platform has a finite list of entity collections. Each entity collection contains entities (for example,
Things) of the respective type (for example,
/Things contains all things). The EMS supports the
Things entity collection and the
Properties and
ThingName characteristic collections. It also supports the File Transfer Subsystem and Services that are associated with Things. For more information, refer to the section.
REST Web Services Supported by EMS.