cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to get one user's changes in thingworx composer

AP_9587236
17-Peridot

How to get one user's changes in thingworx composer

How to get one user's changes in thingworx composer. Any restapi is available? or

Writing a custom service by passing username, startdate as inputs to query datas in Application logs file will help? 

4 REPLIES 4
Mukul
14-Alexandrite
(To:AP_9587236)

If you want to see any configuration changes done by a specific user then you can use http://twxurl:8080/Thingworx/Logs/ConfigurationLog/Services/QueryLogEntries API (either as REST or a JS service in ThingWorx). This API has a default input with name user, just pass this in body and you can get desired rows for that particular user only. I believe similarly you can query other log entries as well (ApplicaitonLog).

AP_9587236
17-Peridot
(To:Mukul)

It is showing Invalid Request when i used this link with my server url and portnumber. I think this Logs entity is not present in 9.2 version. Can u pls check once and let me know.  If it gives infotable as output, then what is its datashape?

I tried this code in service. But the result is not appropriate to my query.

js code:

 

var queryUser = {
"filters":
{
"type": "AND",
"filters": [{
"type": "EQ",
fieldName: "level",
value: "INFO"
},
{
type: "EQ",
fieldName: "user",
value:"Abinaya"
}]
}
};
var allUserRecords = Logs["ApplicationLog"].QueryLogEntries({
query: queryUser
});
var result = allUserRecords[0];

 

Output json is :

{
"instance": "",
"level": "TRACE",
"session": "",
"origin": "c.t.w.c.ThreadLocalContext",
"thread": "http-nio-8080-exec-12",
"platformId": "",
"user": "Abinaya",
"content": "----> CURRENT security context [user: Abinaya, depth: 1]",
"timestamp": 1645256452073
}

 

Mukul
14-Alexandrite
(To:AP_9587236)

I am testing this on Thingworx 9.2.3 only. Here is my call snapshot from Postman including the result.

 

Mukul_0-1645552684530.png

 

slangley
23-Emerald II
(To:AP_9587236)

Hi @AP_9587236.

 

I think the url referenced in Mukul's post should have been:  http://<domain_name>:<port>/Thingworx/Logs/ConfigurationLog/ServiceDefinitions/QueryLogEntries

 

Note, you can access all ThingWorx entities by running http://<domain_name>:<port>/Thingworx/Server and drilling down to find the desired one.

 

Regards.

 

--Sharon

 

Announcements


Top Tags