Chapter Exercise
Design and Build Great Web APIs — by Mike Amundsen (15 / 127)
--
👈 What’s Next? | TOC | Chapter 2 Understanding HTTP, REST, and APIs 👉
For this exercise, you’ll extend the skills you learned in this chapter by curl-ing all three of the services you learned about in this chapter (Company, Account, and Activity) and storing the results in our services folder. You’ll then update your local repository and, finally, sync the remote GitHub repository with your local copy.
First, here are the URLs you can use to make API calls with curl to save in your services folder:
- https://company-atk.herokuapp.com (save the output as company-home.json)
- https://company-atk.herokuapp.com/list (save the output as company-list.json)
- https://company-atk.herokuapp.com/2258ie4t68jv (save the output as company-record.json)
- https://account-atk.herokuapp.com/list (save the output as account-list.json)
- https://account-atk.herokuapp.com/1c0x0mzp83t (save the output as account-record.json)
- https://activity-atk.herokuapp.com/list (save the output as activity-list.json)
- https://activity-atk.herokuapp.com/2dra7wqcyup (save the output as activity-record.json)
Use these URLs with the curl utility in the format curl <URL> > <filename> to save all seven responses to disk in the services subfolder of your project. We’ll use this services folder as the start of our API project and will start managing that project with Git in the next chapter.
See Appendix 2 (Solution for Chapter 1: Getting Started with API First) for the solution.
Footnotes
[7] https://www.programmableweb.com/api-university/understanding-api-first-design
[9] http://asserttrue.blogspot.com/2009/04/api-first-design.html
[10] https://apievangelist.com/2014/08/11/what-is-an-api-first-strategy-adding-some-dimensions-to-this-new-question
[11] https://pragprog.com/titles/maapis/source_code
[12] https://github.com/kevinswiber/siren
[13] https://github.com/collection-json/spec
Copyright © 2020, The Pragmatic Bookshelf.
👈 What’s Next? | TOC | Chapter 2 Understanding HTTP, REST, and APIs 👉
Design and Build Great Web APIs by Mike Amundsen can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.