Slides of a tech talk I had done in Feb 2021 covering useful tools for API development & lifecycle management.
Resource reference:
1. Mockoon
https://mockoon.com/
https://mockoon.com/docs/latest/templating/
Assignment 1: Run mockoon via CLI
Tip: https://mockoon.com/cli/
2. Postman Mock
https://www.postman.com/
https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/mocking-with-examples/
Assignment 2: Try random data dynamic variables and query param based response.
3. Postman Tests
https://learning.postman.com/docs/writing-scripts/test-scripts/
Assignment 3: Install Neoman and run a collection from CLI
Tip: https://learning.postman.com/docs/running-collections/using-newman-cli/command-line-integration-with-newman/
4. Postman Monitors
https://learning.postman.com/docs/designing-and-developing-your-api/monitoring-your-api/intro-monitors/
Assignment 4: Build your own monitor using Jenkins and Postman collection
5. JMeter
https://jmeter.apache.org/usermanual/get-started.html
https://jmeter.apache.org/usermanual/test_plan.html
jmeter -n -t API_Load_Testing.jmx -l results.jtl
jmeter -g results.jtl -o results
6. Stoplight Spectral
https://meta.stoplight.io/docs/spectral/docs/getting-started/2-installation.md
https://meta.stoplight.io/docs/spectral/docs/guides/4-custom-rulesets.md
spectral lint uspto.yaml
spectral lint -r custom-rules-spectral.yml uspto.yaml
Assignment 5: Custom linting for mandatory examples
7. Stoplight Prism
https://meta.stoplight.io/docs/prism/docs/getting-started/01-installation.md
https://meta.stoplight.io/docs/prism/docs/getting-started/03-cli.md
https://meta.stoplight.io/docs/prism/docs/guides/01-mocking.md
prism mock uspto.yaml
Assignment 6: Use Prefer option to choose mock responses.
8. OpenAPI CLI
https://redoc.ly/docs/cli/commands/
Assignment 7: Try the commands
lint
stats
preview-docs
join
...
9. Request bin
https://requestbin.com
Assignment 8: Setup a bin and sedn request to it from Postman
10. NGROK
https://ngrok.com/download
ngrok http 7071
Assignment 8: Expose a local endpoint using ngrok and register it as webhook
2. Caution!
• Less time and lot of content to share
• 70 mins presentation & 20 mins Q&A [Timer 55+15+20]
• Knowing about a tool != Knowing the tool
• Focus is REST / HTTP-JSON APIs
3. How to get max value?
• Try to grasp the purpose / value proposition of the tool.
• Don’t ask questions about setup/settings of individual tools. All that
will be available in documentation links I will share for your reading.
• Listen to everything. What is not relevant today might become
tomorrow.
• Real learning will happen when you start trying/using the tool after
the session.
4. Format
• Scenario / context
• Tool
• Capabilities
• How to use (demo)
• Resources (shared on #api-tools-techtalk)
• Assignment (1+1)
* And some interesting “tool” quotes
10 tools
~ 6-8 mins / tool
6. Mocking
• Phases – Ideation, Design, Prototyping, Development, Testing
• Starting from scratch. No spec and code exists.
• API First
• Mockoon
• Iteratively “create” functional API endpoints (resources, methods,
attributes) with trial and adjustment.
• Local development and testing of UI/service without real backend
• Automate with CLI
1/10
7. • "A good tool improves the way you work. A great tool improves the
way you think."
~ Jeff Duntemann
8. Mocking
• Phases – Design, Prototyping, Development, Testing, Integration.
• Collaborate using shared/published/stable endpoints.
• Developing UI, Proxy, Tests for APIs, CI, Services which consume APIs.
• Postman mocks
• Define sample responses for requests in collections and publish mock
endpoints.
• Dynamically vary responses.
2/10
9. "It is essential to have good tools, but it is also essential that the tools
should be used in the right way."
~ Wallace D. Wattles
10. Testing – Contract (producer or consumer)
• Phases. – Development, Testing, Integration
• As producer/consumer ensure the API is working as expected
• Postman tests & collection runner
• Scripts with assertions for validation of behavior
• TDD approach
• Tests run manually or automated
• Independent of client/producer implementation language
3/10
11. "You have to pick the right tool for the point you're trying to make and
there is no one solution."
~ Jay Maisel
12. Monitoring
• Phases – Production, Operation
• Check availability of published API endpoints, uptime, analytics, alerts
• Postman monitors
• Create monitors from existing collection
• Get alerts, metrics etc.
• Free plan has limited quota
4/10
13. "You cannot mandate productivity, you must provide the tools to let
people become their best."
~ Steve Jobs
14. Performance and Load
• Phase – Testing, Pre-prod, Prod
• Test behavior and performance of service under load
• JMeter
• Define users, requests, endpoints, response
• Run test
• Analyze results
5/10
15. "If the only tool you have is a hammer, it's hard to eat spaghetti."
~ David Allen
16. Linting (Spec)
• Phase – Design, Documentation, Review
• Check OpenAPI document for correctness, completeness, guidelines
• Stoplight Spectral
• Lint/static analysis of OpenAPI document
• Test for custom (organization specific) rules
6/10
17. "We become what we behold. We shape our tools and then our tools
shape us."
~ Marshall McLuhan
18. Mock service (OpenAPI based)
• Phase – Development, Testing
• Developing client app when service endpoint not available
• Stoplight Prism
• Create mock service from OpenAPI definition
• Generate static/dynamic responses
• Generate responses from examples
7/10
19. "Technology and tools are useful and powerful when they are your
servant and not your master."
~ Stephen Covey
21. "Work whatever tools you may have at your command and better tools
will be found as you go along."
~ Napoleon Hill
22. Webhooks
• Phase – Exploration, Development
• Integrating with services which provide webhooks
• Get public endpoints
• Introspect payloads live
• requestbin.com
9/10
24. Webhooks
• Phase – Development, Testing
• Developing handlers for webhook and need public endpoint for
testing
• ngrok
• Expose local endpoint on internet for testing/collaboration
10/10
25. "There is a great satisfaction in building good tools for other people to
use."
~ Freeman Dyson