building apis for the modern enterprise

17
Building APIs for the Modern Enterprise Jake Peyser IBM Bluemix Developer Advocate #apiMixTheWorld @jakepeyser

Upload: jake-peyser

Post on 16-Apr-2017

141 views

Category:

Software


0 download

TRANSCRIPT

Building APIs for the Modern Enterprise

Jake PeyserIBM Bluemix Developer Advocate

#apiMixTheWorld @jakepeyser

@jakepeyser

1. Sign up for Bluemix at https://ibm.biz/apiworld15

2. Go to https://email-collector.mybluemix.net and submit your Bluemix email

#apiMixTheWorld

Prerequisites

@jakepeyser#apiMixTheWorld

Email Collector

@jakepeyser#apiMixTheWorld

Enterprise Analog

server contents

Desktop Browser /

Kiosk

Monitoring and Analytics

Auto-Scaling

SQL Database

SendGrid

corporate data center

Clo

ud In

tegr

atio

n S

ecur

e C

onne

ctor

Enterprise Directory

Cloud Integration

Secure

Connection

@jakepeyser#apiMixTheWorld

Without considering reusability, collaboration fails.Without collaboration, we work against each other.

@jakepeyser

• IBM partnered with The Weather Co.

• Demo built to showcase API

• Custom Swagger 2.0 compliantAPI simplifies exposure of this key data

#apiMixTheWorld

Capital Weather

@jakepeyser

• Download the swagger.json file for Capital Weather from GitHub [source]

• This API can easily be consumed by any client, but then management

would fall on our development team

• API Management helps orchestrate this process

#apiMixTheWorld

Phase 1

@jakepeyser

• Go to the Bluemix Catalog and select the API Management service

• Instantiate the service and open up the API Manager from the console

• Create a new API by importing the swagger.json file

• Set the proxy for each operation (i.e. https://capital-weather.mybluemix.net/api/currentConditions)

• Create a new plan with which to expose your proxy API, add all your API

operations, and stage it

• Publish the API to your organization

#apiMixTheWorld

Phase 2

@jakepeyser

• Head back to the catalog and filter to ‘Custom APIs’

• Create a new instance of the service

• Try out some of the test queries on the next slide

• Either use a REST API tester like Postman or just paste it in your browser

• We can see fine-grained analytics regarding API usage

#apiMixTheWorld

Phase 3

@jakepeyser

• Replace <ORG> in each URL with your Bluemix email

• Get current conditions for (20°, 34°)

• https://api.apim.ibmcloud.com/<ORG>-dev/sb/api/currentConditions?latitude=20&longitude=34

• Get historic conditions for (50°, -24°)

• https://api.apim.ibmcloud.com/<ORG>-dev/sb/api/historicConditions?latitude=50&longitude=-21

• Get past conditions for (56°, -76°) on 4/23/13

• https://api.apim.ibmcloud.com/<ORG>-dev/sb/api/pastConditions?

latitude=56&longitude=-76&month=4&day=23&year=2013

• Predict future conditions for (16°, -60°) on 2/7

• https://api.apim.ibmcloud.com/<ORG>-dev/sb/api/predictConditions?

latitude=16&longitude=-60&month=2&day=7

#apiMixTheWorld

Test Queries

@jakepeyser

• Let’s add some authorization to our API

• We will add client ID and client secret validation to each query

• We can also manage which organizations can access our API

• I’ve invited you all to a space in my organization ([email protected]) to

leverage my API

#apiMixTheWorld

Phase 4

@jakepeyser

• Now you all have access to my Weather History API v2

• To showcase how we can utilize this API, we’ll use a Watson Q&A sample

• https://github.com/IBM-Bluemix/watson-QA-demo

• Deploy your own instance of the app to my org and explore the app

• Next, we’ll bind the Weather API v2 to our app

• name the service “weather-service-XXX” where XXX is a unique string

• Explore the updated app and look into the code making it possible

• Finally, we’ll look at the analytics again now multiple apps are leveraging the API

#apiMixTheWorld

Phase 5

@jakepeyser

• What is the current weather in Anchorage, Alaska {61.22, 149.9}?

• What is the historical weather for today in Chicago {41.84, 87.68}?

• On 8/28/91, what was the past weather in New York City {40.71, 74}?

• Can you predict the weather in Florence, Italy {43.78, 11.25} on 10/7/15?

#apiMixTheWorld

Test Questions

@jakepeyser

• Banking - Retrieve loan information using operations that filter specific datasets

for certain organizations and access levels

• Insurance - Build an interface to a background check system, allowing

customers to leverage this service themselves under specific conditions

• Federal - Allow citizens to retrieve their own personal information using strong

security measures not enabled within the SoR

#apiMixTheWorld

Real World Use Cases

@jakepeyser#apiMixTheWorld

Software is infinitely reproducible. Building assets with collaboration in mind helps

institute “social coding” cultures

Thank you

#apiMixTheWorld @jakepeyser

@jakepeyser

• Email Collector Tool - https://github.com/IBM-Bluemix/email-collector

• Capital Weather Demo - https://github.com/IBM-Bluemix/capital-weather

• raw swagger.json file [source]

• Swagger UI API docs - https://capital-weather.mybluemix.net/api-docs/

• Watson Q&A Demo - https://github.com/IBM-Bluemix/watson-QA-demo

• IBM-Bluemix Github - https://github.com/IBM-Bluemix

#apiMixTheWorld

Resources