Skip to main content
10-Marble
June 4, 2024
Question

How Thingworx Get API works ?

  • June 4, 2024
  • 1 reply
  • 1624 views

Hello, 

 

i'm using Thingworx at my work place and i'm trying to understand how Thingworx API works. Is Data requested from the Database? How the data flow works , for a GET request for example ? 

 

Many thanks 

1 reply

16-Pearl
June 4, 2024

Hi @Lo_ry96  Look at the below article, and let us know if you have any doubts.

https://www.ptc.com/en/support/article/CS328166

Lo_ry9610-MarbleAuthor
10-Marble
June 5, 2024

hi, thanks for the information provided. Still, it's not very clear how data flow works once a get request is made using API. Can elaborate on that please? 

BR

19-Tanzanite
June 5, 2024

Considering that there are hundreds of API (if we're looking at the Snippets themselves, exposed as APIs) it's impossible to describe how each works in detail, or the data flow for this matter.

What happens however, at its core, is that the logic behind each API call is basically a combination of local logic executed at the level of the instance, in Java, and database calls (which will happen in any of the databases ThingWorx is using, like PostgreSQL, MSSQL, InfluxDB etc).

It's not mandatory that both will happen - it all depends on that specific API logic. For example: creating an infotable entry based on a Datashape will issue NO call to the database, but executing a QueryPropertyHistory will issue a call to the database.

Generally speaking, all the API calls that "generally" read "stuff" (not including historical data or table data) do not result in a call to the database, since ThingWorx loads the model in-memory.

Anything that will "update" or "write" data (create a Thing, property) will result in a write to the database (to persist the change).

What I wrote above is extremely general in nature - many exceptions exist.

 

What exactly would you want to achieve in the platform? If you would be able to share some details we can certainly advise on what's the best way to do that.