DEVNET-1631 Your API Toolbelt Tools and techniques for testing, monitoring, and troubleshooting REST API requests Adam Kalsey, Spark Developer Relations
Cisco Spark How Questions? Use Cisco Spark to communicate with the speaker after the session 1. Find this session in the Cisco Live Mobile App 2. Click Join the Discussion 3. Install Spark or go directly to the space 4. Enter messages/questions in the space cs.co/ciscolivebot#devnet-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Your API Toolbelt
curl
curl <options> url DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
curl -d "foo=bar" DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
curl -X PUT curl -X POST DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
curl -d "foo=bar" X POST curl -d "foo=bar" DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
curl d "foo=bar" example.com curl example.com d "foo=bar" DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
curl i DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
curl i curl I DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
curl u myname p p455w0rd! DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
curl u myname p > Enter password for 'myname': DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
curl n example.com DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
curl n example.com $ more ~/.netrc machine example.com login myname password p455w0rd! DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
curl H "Authentication: Bearer t0k3ndecafbad" DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
Postman
Fiddler
Requestb.in
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 29
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
jq
$ curl -H "Authorization: Bearer YzEasdpojcweOTcw" https://api.ciscospark.com/v1/rooms {"items":[{"id":"y2lzy29zcgfyazovl3vzl1jpt00vywy2mze4nzqtntawmi0zntnlltk4yjmtmthhytuxytk zmty3","title":"steve Sfartz","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:19:49.952Z","creatorId":"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGE toti4my1iymfintjmogizmja","created":"2017-11- 30T14:19:49.137Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT00vMjMyNTc5MzYtMDE3Ny0zMWM1LWExNWEt NDZmMWU5ZGU1NmNk","title":"David Bruun-Lie","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:15:53.349Z","creatorId":"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGE toti4my1iymfintjmogizmja","created":"2017-11- 30T14:15:52.140Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT00vYzA2YjVjNzEtYjFmMS0zYmZjLTg5ODUtNmI 4MDc3NmE2NTA4","title":"Henrik Bakken","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:07:33.394Z","creatorId":"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGE toti4my1iymfintjmogizmja","created":"2017-11- 30T14:07:32.409Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT00vMTA2YmI4ZDQtNzU3OS0zZThhLWE2ZGEtN TBmYTkwODRiYjVl","title":"Torkild Retvedt","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:12:32.301Z","creatorId":"Y2lzY29zcGFyazovL3VzL1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGE toti4my1iymfintjmogizmja","created":"2017-11- 30T12:15:08.447Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT00vMGQ2NzFiMTEtNzM5Mi0zYWM3LTkzNDYtN TUzYTZmZDdlMGJm","title":"Phil Bellanti","type":"direct","isLocked":false,"lastActivity":"2017-11 DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
$ curl https://api.ciscospark.com/v1/rooms jq. DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
$ curl https://api.ciscospark.com/v1/rooms jq '.items[] {id:.id, name:.title}' DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
jq '.items[-1] {id, type}' { } "id": "Y2lzY29zcGFyazovL3VzLjFlMzgyYzgtNmE2Yi0zMGU3LTk2MDktMDc3YWYzZDQ4NjY0", "type": "direct jq '.items[-1] {roomid:.id, roomtype:.type}' { } "iroomid": "Y2lzY29zcGFyazovL3VzLjFlMzgyYzgtNmE2Yi0zMGU3LTk2MDktMDc3YWYzZDQ4NjY0", roomtype": "direct DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 35
jq
JSON Lint
{"items":[{"id":"y2lzy29zcgfyazovl3vzl1jpt00vywy2m ze4nzqtntawmi0zntnlltk4yjmtmthhytuxytkzmty3","title":"steve Sfartz","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:19:49.952Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:19:49.137Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT 00vMjMyNTc5MzYtMDE3Ny0zMWM1LWExNWEtNDZm MWU5ZGU1NmNk","title":"David Bruun- Lie","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:15:53.349Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:15:52.140Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT 00vYzA2YjVjNzEtYjFmMS0zYmZjLTg5ODUtNmI4MDc3N me2nta4","title":"henrik Bakken","type":"direct","isLocked":false,"lastActivity":"201 7-11- 30T14:07:33.394Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:07:32.409Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT
{"items":[{"id":"y2lzy29zcgfyazovl3vzl1jpt00vywy2m ze4nzqtntawmi0zntnlltk4yjmtmthhytuxytkzmty3","title":"steve Sfartz","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:19:49.952Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:19:49.137Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT 00vMjMyNTc5MzYtMDE3Ny0zMWM1LWExNWEtNDZm MWU5ZGU1NmNk","title":"David Bruun- Lie","type":"direct","isLocked":false,"lastActivity":"2017-11- 30T14:15:53.349Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:15:52.140Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT 00vYzA2YjVjNzEtYjFmMS0zYmZjLTg5ODUtNmI4MDc3N me2nta4","title":"henrik Bakken","type":"direct","isLocked":false,"lastActivity":"201 7-11- 30T14:07:33.394Z","creatorId":"Y2lzY29zcGFyazovL3Vz L1BFT1BMRS84NzNhMTBjMi0wNWU3LTQxMGEtOTI4 My1iYmFiNTJmOGIzMjA","created":"2017-11- 30T14:07:32.409Z"},{"id":"Y2lzY29zcGFyazovL3VzL1JPT
JSON Lint
JSONView
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 42
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 43
Testing & Validation
{ } "request": { "method": "GET", "url": "/some/thing" }, "response": { "status": 200, "body": "Hello world!", "headers": { "Content-Type": "text/plain" } }
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
stoplight.io Kellar Wilson CC 2.0BY-ND
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 52
DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 53
stoplight.io Kellar Wilson CC 2.0BY-ND
Cisco Spark How Questions? Use Cisco Spark to communicate with the speaker after the session 1. Find this session in the Cisco Live Mobile App 2. Click Join the Discussion 3. Install Spark or go directly to the space 4. Enter messages/questions in the space cs.co/ciscolivebot#devnet-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Please complete your Online Session Evaluations after each session Complete 4 Session Evaluations & the Overall Conference Evaluation (available from Thursday) to receive your Cisco Live T-shirt All surveys can be completed via the Cisco Live Mobile App or the Communication Stations Complete Your Online Session Evaluation Don t forget: Cisco Live sessions will be available for viewing on-demand after the event at www.ciscolive.com/global/on-demand-library/. 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Continue Your Education Demos in the Cisco campus Walk-in Self-Paced Labs Tech Circle Meet the Engineer 1:1 meetings Related sessions DEVNET-1631 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 57
Thank you