Be The API - VMware UserCon 2016

60
Be The API an exploration of careers, supported by code and memes by @mjbrender

Transcript of Be The API - VMware UserCon 2016

Page 1: Be The API - VMware UserCon 2016

Be The APIan exploration of careers, supported by code and memes

by @mjbrender

Page 2: Be The API - VMware UserCon 2016
Page 3: Be The API - VMware UserCon 2016

Business Logic

Page 4: Be The API - VMware UserCon 2016

The Happy Place

Page 5: Be The API - VMware UserCon 2016
Page 6: Be The API - VMware UserCon 2016

The Happy Place

Page 7: Be The API - VMware UserCon 2016
Page 8: Be The API - VMware UserCon 2016

My Less Happy Place

Page 9: Be The API - VMware UserCon 2016
Page 10: Be The API - VMware UserCon 2016

No, Not Again

Page 11: Be The API - VMware UserCon 2016
Page 12: Be The API - VMware UserCon 2016

“Hey, Sisyphus, when you’ve got a minute I’d like to discuss this progress report with you.”

Page 13: Be The API - VMware UserCon 2016

> cd $HOME>>> bash ./admin_scriptfixing foo

Page 14: Be The API - VMware UserCon 2016
Page 15: Be The API - VMware UserCon 2016
Page 16: Be The API - VMware UserCon 2016

> vim ./admin_script

cmd | xarg –n 1 sed –i “s/server/foo/g” | grep -i up >err.log 2>&1

Page 17: Be The API - VMware UserCon 2016

“An Application Programming Interface is a set of routines, protocols, and tools for building software applications.”

Page 19: Be The API - VMware UserCon 2016
Page 20: Be The API - VMware UserCon 2016

Structured input and output

Page 22: Be The API - VMware UserCon 2016

Many Other APIsJSON

JSON

Page 23: Be The API - VMware UserCon 2016

is the API the new CLI

?

Page 24: Be The API - VMware UserCon 2016
Page 25: Be The API - VMware UserCon 2016

> cmd

| grep | sed | awk

Page 26: Be The API - VMware UserCon 2016

the API the new CLI

(if and only if you use the CLI like this example)

Page 27: Be The API - VMware UserCon 2016

> cmd

| grep | sed | awk

Page 28: Be The API - VMware UserCon 2016

JSON

JSON

Page 29: Be The API - VMware UserCon 2016

JSON

JSON

Page 30: Be The API - VMware UserCon 2016

API is a machine interface CLI is a user interfaceGUI is a user interface

Page 31: Be The API - VMware UserCon 2016

An API says:

Request this.

Get that.

Page 32: Be The API - VMware UserCon 2016

{you}

Page 33: Be The API - VMware UserCon 2016
Page 34: Be The API - VMware UserCon 2016

{myapi}

Page 35: Be The API - VMware UserCon 2016

serverAPI

myctl

{myapi} service

Page 36: Be The API - VMware UserCon 2016

GET job/Return a description of my job.

There are no options available for this endpoint.

Page 37: Be The API - VMware UserCon 2016

> myctl job list

Matt is a Developer Advocate. Developer Advocates are technical community contributors key to accelerating project adoption through internal coordination & targeted external contribution.

Page 38: Be The API - VMware UserCon 2016

GET contact/Returns a list of available forms of contact.

typerequired

Return whether the contact is personal or professionalValues: personal, professional, all

include_preferenceoptional

Boolean preference as defined by the serviceExample Value: true

include_reply_timeoptional

Return average response time for requestExample Value: false

Response formats JSON

Requires authentication? No

Rate limited? Yes

Page 39: Be The API - VMware UserCon 2016

curl http://localhost/v1/contact?type=all

{ ”contact":{ ”email": [ { “type": “professional", “to": “REDACTED", }, { “type": “personal", “to": “REDACTED", }, ], ”tweet": [ { "type": “personal”, “to": “@mjbrender", } ], ”call": [ { "type": “personal”, “to": “+REDACTED", } ] } }

Page 40: Be The API - VMware UserCon 2016

> myctl contact list --all

TYPE PREFERENCE REPLY TIMEemail 2 3dtext 3 1mtweet 1 30scall 4 5d

Page 41: Be The API - VMware UserCon 2016

PUT contact/[:to]Request that gets in contact with the API owner. Returns string response to the request.

fromrequired

Return location appropriate for the endpointExample Value: @mjbrender, [email protected]

messagerequired

Reason for the contactExample Value: “Thought you’d like this post”

urgencyoptional

Definition of how quickly a reply is required.Values: Low, Medium, High

include_lead_timeoptional

Boolean to include approximate time to respond.Example Value: true

Page 42: Be The API - VMware UserCon 2016

curl -H “Content-Type: application/json”

-X POST –d ‘{“from”: “@vBrianGraf”, “description”: “Hey!”}

http://localhost/v1/contact/@mjbrender

{ ”confirmation": “Thanks for getting in touch. I’ll response back as soon as time allows.” }

Page 43: Be The API - VMware UserCon 2016

{ ”confirmation": “Thanks for getting in touch. Since this involves something urgent, I’ll get back to you as soon as I can.” }

curl -H “Content-Type: application/json”

-X POST –d ‘{“from”: “[email protected]”, “description”: “House on Fire”,“urgency”: “high”}

http://localhost/v1/contact/[email protected]

Page 44: Be The API - VMware UserCon 2016

GET job/skillReturns a list of advertised job skills.

typeoptional

Return the category of work this falls underValues: ENG, MKT, SALES, FINANCE, MGMT

include_preferenceoptional

Boolean preference as defined by the service provider. Defined on a scale from 1-7 with 7 as most preferredExample Value: 3

include_leveloptional

Boolean level of expertise of the service provider. Expertise is defined on a scale from 1-7 with 7 as bestExample Value: 7

Response formats JSON

Requires authentication? No

Rate limited? No

Page 45: Be The API - VMware UserCon 2016

> myctl skill list --type=ENG -p

SKILL TYPEPREFERENCEBuild Automation ENG 5Product Mgmt ENG 5Dev Mgmt ENG 4Traditional IT ENG 3Cloud Native ENG 7Ruby Developer ENG 3Go Developer ENG 3

Page 46: Be The API - VMware UserCon 2016

> myctl skill list --type=ENG -p

SKILL TYPEPREFERENCEBuild Automation ENG 5Product Mgmt ENG 5Dev Mgmt ENG 4Traditional IT ENG 3Cloud Native ENG 7Ruby Developer ENG 3Go Developer ENG 3

Page 47: Be The API - VMware UserCon 2016

> myctl skill list --type=ENG -l

SKILL TYPE SKILL LEVELBuild Automation ENG 2Product Mgmt ENG 5Dev Mgmt ENG 4Traditional IT ENG 5Cloud Native ENG 3Ruby Developer ENG 2Go Developer ENG 2

Page 48: Be The API - VMware UserCon 2016

> myctl skill list --type=ENG -l

SKILL TYPE SKILL LEVELBuild Automation ENG 2Product Mgmt ENG 5Dev Mgmt ENG 4Traditional IT ENG 5Cloud Native ENG 3Ruby Developer ENG 2Go Developer ENG 2

Page 49: Be The API - VMware UserCon 2016

> myctl skill list --type=MKT -l

SKILL TYPE SKILL LEVELPowerPoint ing MKT 6Podcasting MKT 6Blogging MKT 4Public Speaking MKT 4Product Messaging MKT 5Logo Design MKT 5Social Media MKT 5

Page 50: Be The API - VMware UserCon 2016

GET job/request/Review active work requests with expected completion dates.

typeoptional

Return the category of work this falls underValues: ENG, MKT, SALES, FINANCE, MGMT

include_preferenceoptional

Boolean preference as defined by the service providerExample Value: true

include_lead_timeoptional

Boolean to include default lead time per requestExample Value: true

Response formats JSON

Requires authentication? No

Rate limited? No

Page 51: Be The API - VMware UserCon 2016

> myctl work list -t -lt

REQUEST TYPE LEAD TIMECreate PPT MKT 7dDefine OSS Release ENG 5dTest Automation ENG 3dWrite Blog Post MKT 2dRe to Sales MGMT .5dSchedule Meeting MGMT .25dCreate other PPT MKT 7d

Page 52: Be The API - VMware UserCon 2016

PUT job/request/Request that gets in contact with the API owner. Returns expected response time.

titlerequired

Boolean preference as defined by the serviceExample Value: true

descriptionrequired

Return average response time for requestExample Value: false

urgencyrequired

Return average response time for requestExample Value: false

authorizedoptional

Return average response time for requestExample Value: true

Page 53: Be The API - VMware UserCon 2016

Valid Responses• “Here you go.”• “I can’t do that.”• “I’m on it. I’m estimating a delivery time of” + GET

job/requests/[:type]?lead_time• “I can’t help you with this right now, I’m at capacity. Please

contact my manager.”• “I can’t help you right now due to other urgent priorities.

Please contact my manager.”• “I will get on it right away. Here is the other work that will

be delayed by at least 2 business days by this request:” + GET job/requests/

Page 54: Be The API - VMware UserCon 2016

GETcontact/job/job/skill/job/request/

PUT contact/

job/request/

{myapi}

Page 55: Be The API - VMware UserCon 2016

What’s undocumented?

Endpoint

GET hobby/

Options

tone := Reflect.type(tone)

Page 56: Be The API - VMware UserCon 2016

An API says:

Request this.

Get that.

Page 57: Be The API - VMware UserCon 2016

API is a machine interface CLI is a user interfaceGUI is a user interface

Page 58: Be The API - VMware UserCon 2016

defining our API can help us be better humans

Page 59: Be The API - VMware UserCon 2016

> myctl contact list --best

TO PREFERENCE@mjbrender 1slack.snap-telemetry.io 2

Page 60: Be The API - VMware UserCon 2016