hands-on lab: using ca mobile application analytics rest apis

38
1 © 2015 CA. ALL RIGHTS RESERVED. @CAWORLD #CAWORLD Hands-On Lab: Using CA Mobile Application Analytics REST APIs Vamsee Lakamsani and Harish Lakshminarasimhan DevOps: Agile Ops CA Technologies Product Management DO5X239L @lakamsani #CAWorld

Upload: ca-technologies

Post on 10-Jan-2017

462 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 2: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 3: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 4: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 5: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 6: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 7: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 8: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 9: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

9 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Overview of MAA APIs and Usage in MAA Admin UI

Page 10: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

10 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

MAA Architecturehttps://wiki.ca.com/CAMAA

Page 11: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

11 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

MAA APIs

Page 12: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

12 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

API Details

Page 13: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 14: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

14 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Invoke MAA APIs Using cURL

Page 15: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 16: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

16 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Authentication APIs

Page 17: Hands-On Lab: Using CA Mobile Application Analytics REST 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

Page 18: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 19: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 20: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 21: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 22: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

22 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Invoke MAA APIs Using Advanced REST Client

Page 23: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

23 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Hands-on: Chrome Advanced Rest Client POST get token

Page 24: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

24 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Hands-on: POST /token Response

Page 25: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 26: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

26 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Get /apps Response

Page 27: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

27 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Invoke MAA APIs Using Swagger

Page 28: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

28 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Swagger : Step#1

a) Login to MAA Admin console

b) Click on HELP

Page 29: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 30: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 31: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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.

Page 32: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

32 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Demo Android App Using MAA APIs

Page 33: Hands-On Lab: Using CA Mobile Application Analytics REST 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

Page 34: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

34 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

- Several reports and time filters are available

Page 35: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 36: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

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

Page 37: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

37 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Q & A

Page 38: Hands-On Lab: Using CA Mobile Application Analytics REST APIs

38 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

For More Information

To learn more, please visit:

http://cainc.to/Nv2VOe

CA World ’15