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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

ThingMark scan logs

Martini3119
7-Bedrock

ThingMark scan logs

Hi,

 

We are sharing our ThingMarks with our customers and we would like to see how often a ThingMark is scanned. Each marker is for a predefined customer only. What I am looking for is a log that contains the lifetime history of the usage of a specific ThingMark in the terms of the number of scans and the datetime of each scan. Is it possible to change this command:

 

 

 

 

<es-protocol>://<es-host>:<es-port>/ExperienceService/
compliance/views?startDate=<start-date>&endDate=<enddate>

 

 

 

 

 in such a way that I can find the same information but for a specified ThingMark?

 

Example call:

 

 

 

 

<es-protocol>://<es-host>:<es-port>/ExperienceService/
compliance/views?key=urn:vuforia:vumark:1234:1&startDate=<start-date>&endDate=<enddate> 

 

 

 

 

(I tested this setup and it only results in the overall views and billables).

Example result:

 

 

 

 

{
  "views-marker" = 235,
  "billables-marker" = 156,
  "views" = 470,
  "billables" = 327
}

 

 

 

 

I thought it would be nice to see the marker values and the overall values for comparison in this example, but is not required.

 

Many thanks in advance.

 

With kind regards,

Martini3119

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Martini3119 ,

so far I know, one possible option is that we can receive the rawData (requires a admin account for the experience service)

 

Specific time frame:
GET <ES-protocol>://<ES-host>:<ES-port>/ExperienceService/compliance/views?startDate=<start-date>&endDate=<end-date>
For the detailed client information (such as IP/useragent information), below REST API can be used:
GET <ES-protocol>://<ES-host>:<ES-port>/ExperienceService/compliance/views?startDate=<start-date>&endDate=<end-date>&rawData
JSON object with views and billables will be returned
views = gross number of public views by non-registered users
billables = net number of public views by non-registered users

 

example of such call (call all views after.01.2019 -> to the current time) in chrome browser:

 

https://xxxxxxxx.studio-trial.thingworx.io/ExperienceService/compliance/views?startDate=2019-01-01T00%3A00%3A00.000%2B05%3A30&endDate=1000000000000000&rawData

 

and sample results below : ( the last few lines):

 

.....
,{"id":161,"ip":"xx.xxxx.xxxx.184","useragent":"VuforiaView/9.2.1 (iPad7,5; iOS14.6)","namespaceid":".","store":"projects","path":"/test-picker-shader/index.html","contentname":"test-picker-shader","billable":0,"createdon":"1633943984247"}]}

 

So that we can find here in the rawData the project name and the ip where it was called but also the client info. you can check the rawData for called projects - because there e is thingmark - project name relation

View solution in original post

5 REPLIES 5

Hi @Martini3119 ,

so far I know, one possible option is that we can receive the rawData (requires a admin account for the experience service)

 

Specific time frame:
GET <ES-protocol>://<ES-host>:<ES-port>/ExperienceService/compliance/views?startDate=<start-date>&endDate=<end-date>
For the detailed client information (such as IP/useragent information), below REST API can be used:
GET <ES-protocol>://<ES-host>:<ES-port>/ExperienceService/compliance/views?startDate=<start-date>&endDate=<end-date>&rawData
JSON object with views and billables will be returned
views = gross number of public views by non-registered users
billables = net number of public views by non-registered users

 

example of such call (call all views after.01.2019 -> to the current time) in chrome browser:

 

https://xxxxxxxx.studio-trial.thingworx.io/ExperienceService/compliance/views?startDate=2019-01-01T00%3A00%3A00.000%2B05%3A30&endDate=1000000000000000&rawData

 

and sample results below : ( the last few lines):

 

.....
,{"id":161,"ip":"xx.xxxx.xxxx.184","useragent":"VuforiaView/9.2.1 (iPad7,5; iOS14.6)","namespaceid":".","store":"projects","path":"/test-picker-shader/index.html","contentname":"test-picker-shader","billable":0,"createdon":"1633943984247"}]}

 

So that we can find here in the rawData the project name and the ip where it was called but also the client info. you can check the rawData for called projects - because there e is thingmark - project name relation

Hi @RolandRaytchev ,

 

Cool! Works like a charm:

{
            "id": 498,
            "ip": "xxxx",
            "useragent": "Dalvik/2.1.0 (Linux; U; Android 11; AC2003 Build/RP1A.201005.001) VuforiaView/9.2.3.2680 (AC2003; 11)",
            "namespaceid": ".",
            "store": "projects",
            "path": "/xxxx/index.html",
            "contentname": "xxxx",
            "billable": 1,
            "createdon": "1633963917395"
        },
        {
            "id": 499,
            "ip": "xxxx",
            "useragent": "Mozilla/5.0 (Linux; Android 11; AC2003 Build/RP1A.201005.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/94.0.4606.71 Mobile Safari/537.36 VuforiaView/9.2.3.2680 (AC2003; 11)",
            "namespaceid": ".",
            "store": "projects",
            "path": "/xxxx/index.html",
            "contentname": "xxxx",
            "billable": 1,
            "createdon": "1633963917793"
        }

I have a few follow-up questions, if you have the time:

  1. What is the meaning of the "createdon" value? The first ten are the datetime timestamp. As seen in my example, it says 1633963917 (10/11/2021, 4:51:57 PM), but what are the last three numbers for?
  2. Why is the call logged twice, despite being logged in a slightly different manner? Next to the difference in the user agent, there does not seem to be any valuable information present.
  3. It seems I cannot see this data from experiences that require authentication. Could you confirm this, please?

Many thanks in advance!

 

With kind regards,

Martini3119

Hi @Martini3119 ,

because I found this info after some internal database search - so far I will answer your question so far I know:

-1.) the last 3 number are possibly the value of the milliseconds - because time value is based . so far I know on milliseconds 

2.)I believe this question is related to the example call in last post which is encoded:

 

https://xxxxxxxx.studio-trial.thingworx.io/ExperienceService/compliance/views?startDate=2019-01-01T00%3A00%3A00.000%2B05%3A30&endDate=1000000000000000&rawData

So when we decode it then it will look like (see also https://www.url-encode-decode.com/ )

https://xxxxxxxx.studio-trial.thingworx.io/ExperienceService/compliance/views?startDate=2019-01-01T00:00:00.000+05:30&endDate=1000000000000000&rawData

 

So we have the date&time full format + time zone and the second parameter  is some large value which is remote future.

3.) definitely you need to be an user with  admin permission - means  you need to use credential or app key. That means that on browser you need to authenticate but when you use something like node.js or javascript you can do this by some parameters (using fiddler you can record you call from browser to experience service and check shat of parameter are used. Then you can try this in POSTMAN (google app) and when this work then translate the call to the desired language -node.js, javascript etc. So far I think you can also check the request in the google browser Shift-String-I  then performs the request and check the Header for the Network section – especially  the Authorization parameter (app key format string) :

 

Accept-Language: en-US,en;q=0.9
Authorization: Basic cnJheXxxxxxxxxxxxxxxxxxx0A=
....

 

Hi @RolandRaytchev ,

 

Nice! I set the first reply as the solution of this query.

Regarding question #3, I assume the latter will not work, since authentication is already in place based on the admin account, but I will try anyways.

 

Thanks you very much for your assistance!

 

With kind regards,

Martini3119

Hi @Martini3119 ,

Yes it is correct that the Authentication  attribute could be obtained only when the identification is in place  (yes admin account or account with admin rights in TWX instance of the Experience service) But this key attribute so far I know, implies the authentication properties (user/pwd) and will not change for the same user until e.g. password is changed 

So, for example the generated on posman code (node.js) with specific credentials  user/pwd e.g. (key and url are not complete here) will always work so far you have the same credentials and does not need an active broser session:

 

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://xxxxxxxx.studio-trial.thingworx.io/ExperienceService/compliance/views?startDate=2019-01-01T00%3A00%3A00.000%2B05%3A30&endDate=1000000000000000&rawData',
  'headers': {
    'Authorization': 'Basic cnxxxxxxxxxxxxxxxxxxxxxx0A='
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

 

 

 

Top Tags