cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2469
Views
0
Helpful
9
Replies
liminche
Beginner

How to use the Analytics API of MSE?

Recently I am studying the analytics api of MSE. According to the api doc, the parameters of request body is json array. However, I tried to input some parameters in json array format in its body window, the response always tells me I miss key parameters, just like below:

Capture.JPG

Is there anything wrong in my input?

9 REPLIES 9
matfarre
Frequent Contributor

Hi Limin,

First, try validating your JSON body using JSONLint tool http://jsonlint.com/, or similar.  Next, we need to find working examples.  I will ask the CMX team if they can provide some for each REST API call.

Matt

Hi, Matt:

     Thanks for your kind help. Actually, I tried many different kinds of format, some formats are wrong. Because I use the standard json array format but it can't be recognized. So I have to guess. Below is a right json array format, you can test it in JSONLint tool you give me http://jsonlint.com/,

     [{

       "granularity": "daily"

     }]

However, the response code is still 400, it still said "Required parameter 'granularity' not found". So I really wonder why it's wrong. As you say, we need to find working examples. Thanks for your help.

Limin

Hi Matt,

Have you got updates from CMX team? I met similar issues on all the analytics API call, can't figure out how to properly set the 'json array'.

An working API call example would be very helpful to us.

Regards

Terence

Hello Matt,

Sorry for urging on this again, however we do have tried lots of possible parameter combinations and format and still no good return.

Any guidance or hint on this topic will be very helpful. Could you please help to remind anyone who suppose to be able answer this question?

matfarre
Frequent Contributor

Xin,

Agreed, I will escalate the issue with the CMX team.  The body of every Analytic POST request is missing implementation notes. 

For example, the Cisco EMSP API document Cisco EMSP uses Swagger, also.  For each body, the description is clear and intuitive in the implementation notes.  Looking at the raw swagger body.json, these details are not present, so the implementation notes had to have been added by the API developer.  The Cisco EMSP API is using Swagger version 1.2.  Possible version difference may prevent these details from being added by Cisco CMX API docs.

I will forward this to the CMX team for a 2nd try. 

Thanks,

Matt

Cisco EMSP API document snippet

body

keyvalues {
property1 (string, optional),

property2 (string, optional)

}

body

{ "property1": "", "property2": "" }
Click to set as parameter value

matfarre
Frequent Contributor

Xin,

Please, try the analytic POST on another CMX 10 deployment to verify the current CMX environment/simulator is working as expected.  We will then have more information to post to the debug forum.  Try using MSE https://128.107.14.144/  admin/admin, which is the latest 10.2.2 early release candidate.


Currently, we are referred to the https://<MSE IP ADDRESS>/apidocs for API information.  This "live" document is updated with each release of general available software for MSE.  Therefore, with the soon to be released 10.2.2, I hope we get more clarification on the use of the API, such as which parameters are required/optional, and examples of REST API body containing JSON or XML.  If there is something you are completely blocked on, we can reach out to the engineering team for help.  The response time for answering each question vary, depending on the question and severity.  Let me know if you get stuck and we can try to escalate the issue.

Matt

mcrooks
Beginner

Hi All,

Was this ever resolved?  I have run into similar using swagger and also postman.

Best,

Mike

matfarre
Frequent Contributor

Hi Mike,

I get good results using Postman POST https://devnetapi.cisco.com/sandbox/mse/api/analytics/v1/deviceDwell with the following body:

{

  "granularity": "null",

  "period": "forever",

  "timeRange": "now",

  "areas": ""

}

However, the live docs /apidocs responds with:

{
   
"title": "Client Caused Exception",
   
"detail": "ABAPI-010: Required parameter 'granularity' not found.",
   
"httpStatus": 400
}

I will check the latest REST API Guide, Release 10.2 Cisco Mobility Services Engine - Programming Guides - Cisco

against the CMX 10.2.3-34 live docs /apidocs/analytics-api to see if there are other problems.


I will open and post the description/summary of the trouble ticket for the /apidocs deviceDwell resource here.


Thanks,

Matt

Hi @Matt

We are seeing this on a live instance of CMX that we have deployed for a client.   I will test out the sandbox again with your findings and see. Thanks for your attention on this

Best,

Mike

Content for Community-Ad

This widget could not be displayed.