Solution for Chapter 3: Modeling APIs
Design and Build Great Web APIs — by Mike Amundsen (114 / 127)
--
👈 2: HTTP, REST, and APIs | TOC | 4: g APIs 👉
In the Chapter Exercise, we introduced the related CreditCheck service. This will be used to check the creditworthiness of our new on-boarded customers.
The specific task is to create the credit-check-workflow.txt document. By inspecting the credit-check-story.md and credit-check-story.pdf documents in the code download for this chapter, you should be able to come up with a simple workflow that captures the CreditCheck service.
Updating the Credit-Check-Workflow Document
To make this a bit easier, you have a partially completed credit-check-workflow.txt document to start with. It has two steps in the flow already named (Home and CreditCheckForm) and two steps identified but not named (Action1??? and Action2???). By reading through the story you should be able to come up with the two remaining steps that aren’t in the workflow document.
The two unnamed workflow actions are CreditCheckHistory and CreditCheckItem. When you update your document, it should look like this:
## Credit Check Workflow
Home -> CreditCheckHistory
CreditCheckHistory -> CreditCheckForm(companyName) -> CreditCheckItem
CreditCheckItem -> CreditCheckHistory
CreditCheckHistory -> Home
Saving the Documents to the assets Folder
After saving the updated document (credit-check-workflow.txt), copy that document and the others for this solution (credit-check-story.md and credit-check-form.pdf) into a subfolder of the onboarding project (onboarding/assets). Your folder should now look like this:
mca@mamund-ws:~/onboarding$ ls assets/
credit-check-cycles.md credit-check-story.pdf credit-manager-form.html
credit-check-story.md credit-check-workflow.txt credit-manager-form.pdf
mca@mamund-ws:~/onboarding$
Updating the Project with Git
The final step is to commit these changes to the project using Git:
mca@mamund-ws:~/onboarding$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
assets/
nothing added to commit but untracked files present (use "git add" to track)
mca@mamund-ws:~/onboarding$ git add --all
mca@mamund-ws:~/onboarding$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: assets/credit-check-cycles.md
new file: assets/credit-check-story.md
new file: assets/credit-check-story.pdf
new file: assets/credit-check-workflow.txt
new file: assets/credit-manager-form.html
new file: assets/credit-manager-form.pdf
mca@mamund-ws:~/onboarding$ git commit -m"update assets for credit-check"
[master 106f529] update assets for credit-check
6 files changed, 77 insertions(+)
create mode 100644 assets/credit-check-cycles.md
create mode 100644 assets/credit-check-story.md
create mode 100644 assets/credit-check-story.pdf
create mode 100644 assets/credit-check-workflow.txt
create mode 100644 assets/credit-manager-form.html
create mode 100644 assets/credit-manager-form.pdf
mca@mamund-ws:~/onboarding$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
mca@mamund-ws:~/onboarding$
👈 2: HTTP, REST, and APIs | TOC | 4: g 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.