10. Click Create to create the schema. To go along with your PATCH operation, you’ll require some parameters. One parameter (idParam) and definition (Evidence) were already created for you when you uploaded the API. Click the plus sign within the PATCH operation to add a new parameter:
Figure 6.43 – Operation parameters and response setup
11. You will type in body as the name, set it as required, and use the dropdowns to select body in the Located In dropdown. Then click on Create.
The screen refreshes and you will notice that the schema shows an error. You can choose Fix Reference or Create.
12. Choose Create and follow the same procedure of selecting Reference and selecting the #/definition/Evidence choice. It will look exactly like Figure 6.42.
You’ll notice you still have one error:
Figure 6.44 – Error show need for more parameters
You also need to reference the {id} parameter for the PATCH operation. Click on the parameter plus sign again and add the idParam reference. Figure 6.45 shows that you select Reference and #/parameters/idParam:
Figure 6.45 – Add the idParam parameter
13. Click Create to add your parameter. Your error should disappear, with the results shown in Figure 6.46:
Figure 6.46 – Successful reference of idParam
14. Save your API. Next, navigate to the PUT operation and review Responses:
Figure 6.47 – The Evidence PUT operation settings
As you can see in Figure 6.47, similar to the PATCH operation we just created, a body of Evidence type was required for this API, and it is allowing two status codes that represent what actually happened in the FHIR server. Before we return to the operation-switch example, let’s first review the Evidence schema:
- Click on Definitions so that we can review how Evidence is constructed. Click on Evidence and then switch to the Source icon. This is shown in Figure 6.48:
Figure 6.48 – Definitions will show how data is organized
2. The OpenAPI definition is very lengthy and complex. The benefit of using the form icon to navigate to Definitions and choose Evidence is that when you click on the Source icon, it places you on the line number where Evidence is defined. As you learned before with updating parameters using the Source icon, you can also make updates to your Definitions in the same manner.
Now, you should have a good understanding of what is contained within the path and how operations are part of it, as well as references to definitions and how to add items using the Source icon. Let’s return to operation-switch to show how we implement those paths.
Leave a Reply