Skip to main content
12-Amethyst
July 10, 2024
Solved

How to use Thingworx to get API data from VEC

  • July 10, 2024
  • 1 reply
  • 1194 views

I have the client org ID, x-api-key and x-api-key secret. I want to use a Thingworx service to get the VEC Data. 

 

How do I make this command work in a Thingworx service.

curl -X 'POST' 'https://vuforia.ptc.com/customer-events/<orgid>/report' \
-H 'accept: application/json' \
-H 'x-requested-with: fetch' \
-H 'x-api-key: <x-api-key secret> \
-H 'Content-Type: application/json'

 

https://support.ptc.com/help/vuforia/editor/en/index.html#page/vuforia_editor%2Fexample_0.html%23

Best answer by JR_10569306

I figured it out:

 

Create a service on a thing

No inputs

Output: JSON

Code:

var headers= { "Content-Type": "application/json","x-requested-with": "fetch", "x-api-key": "<api key secret> "Accept": "application/json" }
//var params = {
//    headers: headers /* JSON */,
//    url: 'https://vuforia.ptc.com/customer-events/<org id>/report' /* STRING */
//};
 
var result = Resources["ContentLoaderFunctions"].PostJSON(params);

1 reply

JR_1056930612-AmethystAuthorAnswer
12-Amethyst
July 10, 2024

I figured it out:

 

Create a service on a thing

No inputs

Output: JSON

Code:

var headers= { "Content-Type": "application/json","x-requested-with": "fetch", "x-api-key": "<api key secret> "Accept": "application/json" }
//var params = {
//    headers: headers /* JSON */,
//    url: 'https://vuforia.ptc.com/customer-events/<org id>/report' /* STRING */
//};
 
var result = Resources["ContentLoaderFunctions"].PostJSON(params);