Date post: | 10-Jan-2017 |
Category: |
Technology |
Upload: | ca-technologies |
View: | 465 times |
Download: | 0 times |
1 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-On Lab: Using CA Mobile Application Analytics REST APIs
Vamsee Lakamsani andHarish Lakshminarasimhan
DevOps: Agile Ops
CA Technologies
Product Management
DO5X239L
@lakamsani#CAWorld
2 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
© 2015 CA. All rights reserved. All trademarks referenced herein belong to their respective companies.
The content provided in this CA World 2015 presentation is intended for informational purposes only and does not form any type of
warranty. The information provided by a CA partner and/or CA customer has not been reviewed for accuracy by CA.
For Informational Purposes Only
Terms of this Presentation
3 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Abstract
In this API driven world, gaining API access to your enterprise’s app
analytics data is critical to being proactive about resolving issues and
building tools like your own executive insights dashboard with KPI. In this
guided, hands-on lab session, learn how to use the REST APIs provided by
CA Mobile App Analytics to access analytics data using command line
tools like ‘cURL' or browser based tools like Advanced REST Client. These
are the same APIs used by the advanced analytics visualization displayed
in the Mobile Application Analytics Admin Console. We will also show an
example Android mobile app that consumes these APIs and shows a
subset of the CA Mobile App Analytics data in a mobile friendly manner.
VamseeLakamsani
Harish Lakshminarasimhan
CA Technologies
Product Management
4 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Agenda
GETTING STARTED
OVERVIEW OF MAA APIS AND USAGE IN MAA ADMIN UI
DEMO ANDROID APP USING MAA APIS
INVOKE MAA APIS USING CURL
INVOKE MAA APIS USING ADVANCED REST CLIENT
INVOKE MAA APIS USING SWAGGER
1
2
3
4
5
6
5 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Recommended Sessions
SESSION # TITLE DATE/TIME
DO5X187ST-Mobile Provides End-to-End Monitoring of Its New
Mission Critical Applications11/19/2015 at 2:00 pm
DO5X199S
Orange Goes from Dev "Oops" to DevOps with CA
Application Performance Management—Accelerating
Deployment Time and Boosting Application Quality
11/19/2015 at 3:45 pm
DO5X193S
Customize CA Application Performance Management
with Tips for Using the CA Application Performance
Management Open APIs
11/19/2015 at 4:30 pm
6 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Must See Demos
Application Performance Management and DevOps, featuring APM use in preproduction scenarios
Mobile App Analytics
Theater 5
Application Performance Management, Modern Monitoring, featuring the new APM Team Center
Application Performance Management
Theater 5
Ensuring a “5 star” mobile app experience with CA Mobile App Analytics
Application Performance Management
Theater 5
“Mobile to Mainframe” user experience management
Mobile App Analytics
Theater 5
7 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Follow On Conversations At…
Smart Bar
Mobile App Analytics
Theater 5
Tech Talks
Mobile App
Analytics
Theater 5
8 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Getting Started
Make sure you can log on to your Workstation to the Windows VM we will be using for the lab
– Username: Administrator Password: CAdemo123
On your desktop, please check to see if you find the following
– Testscripts folder with sample cURL scripts that invoke MAA APIs. We will use as a starting point
– Google Chrome browser shortcut with Advanced REST Client plugin
– Cygwin short curt with curl and json commands pre-installed
– URL shortcuts for MAA Admin Console
The login for the MAA Admin console
– User id:- [email protected]
– Password:- CAworld@15
– Tenant ID:- CAW15
Follow These Pre-requisites While we get Started With This Session
HANDS ON LAB – PRE REQUISITES
9 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Overview of MAA APIs and Usage in MAA Admin UI
10 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
MAA Architecturehttps://wiki.ca.com/CAMAA
11 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
MAA APIs
12 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
API Details
13 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
API usage in MAA Admin UI
REST APIs used by the MAA Admin UI to display reports and dashboards
Demo via MAA Admin UI using Chrome Developer Console
Separate (non-public) API used by MAA SDK to send data to MAA
14 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Invoke MAA APIs Using cURL
15 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Overview
POST request to obtain access token using base64 encoded tenant id
Construct a Bearer token using the obtained Basic token, tenant scope and Boolean value
GET request to obtain reports and app data using base64 encoded Bearer token
Same sequence of steps for cURL, Advaned REST Client, Swagger or mobile app
16 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Authentication APIs
17 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Authenticating to MAA REST API
POSTObtain token
“205ee65d-459b-417b-8995-46e4050f697c"
Construct Bearer token
{"tkn":"205ee65d-459b-417b-8995-46e4050f697c","all":"true"}
GET Obtain data
Encode Tenant ID
Encode Bearer
User, pwd, tenant id
REST requests
Non-REST operations (scripted)
Modeled after Oauth2
18 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on cURL: Step#1
Open a Cygwin terminal
Open testscripts/ops-curl.sh
Change this
To look like this
19 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on cURL: Step#2
Run the script like this: ./ops-curl.sh GET apps
It invokes the http GET operation on the MAA /appsREST resource
Successful response will return a series of MAA app records in JSON format as shown below
20 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on cURL: Step#3
Review the first few lines of the ops-curl.sh script to see:– how the tenant id is encoded
– The encoded tenant is sent in the http Authorization: Basicheader in in a POST to /ess/security/v1/token (the MAA security server) with a body of user name/password grant_type
– The tkn is field (authorization token) is extracted from the response
– The token is then sent via the http Authorization: Bearerheader field on subsequent REST API calls
– We can use the token with other tools like Advanced REST Client and Swagger
21 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
$SERVER/mdo/v1/performance/apps?aggregation=day&end_date=2015-06-17&start_date=2014-06-10
$SERVER/mdo/v1/performance/apps
/mdo/v1/apps/mdo/v1/performance/apps/mdo/v1/performance/urls/mdo/v1/usage/users/mdo/v1/usage/geo/mdo/v1/sessions/mdo/v1/sessions/list/mdo/v1/profiles
aggregation=day
dayweekmonth
end_date=2015-06-17&start_date=2014-06-10
Only this date format
Filtering via MAA REST APIs
22 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Invoke MAA APIs Using Advanced REST Client
23 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on: Chrome Advanced Rest Client POST get token
24 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on: POST /token Response
25 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Hands-on: Chrome Advanced Rest Client – use token, GET /apps
Token from previous step or from cURL exercise
26 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Get /apps Response
27 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Invoke MAA APIs Using Swagger
28 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Swagger : Step#1
a) Login to MAA Admin console
b) Click on HELP
29 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Swagger : Step#2 a) Click on Reporting API
b) Expand Authentication Operations
c) Select PASSWORD for grant_type
d) Enter username and password
e) Encode tenant using openssl as before and enter into Authorization:
field
30 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Swagger : Step#3a) Token is returned
in the response
b) Copy the token
c) Use openssl to encode token with tenant as in previous steps to generate a Bearer token
31 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Swagger : Step#4
a) Enter the Bearer token in
the Authorization
field
b) Invoke /apps API using
the Bearer token
c) JSON app records are
returned as before with a
200 status code.
32 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Demo Android App Using MAA APIs
33 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
- The app accepts login, reminds about missing and required login information and displays error messages
- Before processing request, the app checks if URL has connectivity
34 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
- Several reports and time filters are available
35 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
- User selects report and filter, and clicks on ‘submit’ to see data
- Data can also be viewed in raw format
36 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Experiences
Custom reports and mobile apps can be built using these APIs
Key topics
CA Mobile App Analytics dashboards are driven by REST APIs
Findings
There are multiple ways to invoke the REST APIs
SummaryA Few Words to Review
37 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
Q & A
38 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD
For More Information
To learn more, please visit:
http://cainc.to/Nv2VOe
CA World ’15