If you have an inventory of APIs and understand how you want to package them in a Product, using a command to do that is perfect. The apic create:product command works on your workstation or build server, not on the API Manager when using drafts.
When you run this command, it sets a version number of the Product and chooses the APIs you wish to package within it. Although we use the same apic command, the arguments are slightly different. You will provide a title of the Product, a specified version, and a list of APIs.
The Observation-swagger.json file was one of the two files you downloaded from GitHub. Run the command as demonstrated in the following code snippet. Notice that there is no server argument. The output will be on your local machine:
apic create:product –title “ObservationProduct” –version 1.0.0 –gateway-type “datapower-api-gateway” –apis “Observation-swagger.json”
Created observationproduct.yaml product definition [observationproduct:1.0.0]
Tip
Be mindful of the quotation marks in this command.
A successful creation will create the Product YAML file that you can now deploy. Let’s do that next.
Publishing to a Catalog
When you publish your Product, you are publishing to a Catalog. You can publish it by using the apic products:publish command to pass the Product YAML filename, the Catalog, the organization, and the server. If you haven’t set the configuration file within your organization and Catalog, you will need to supply them. Run the apic config:list command to verify:
- Let’s publish your product by running the apic products:publish command:
apic products:publish observationproduct.yaml -c <sandbox> -o <middleware> -s <api-manager-ui.apicisoa.com>
observationproduct:1.0.0 [state: published]
2. Once successful, you should be able to view the unique identities of the Catalog and Product. Now you can log in to API Manager and navigate to Manage. Then, click on the Sandbox tile and review the published Product:
Figure 2.23 – The published Product in Sandbox
As you can see in Figure 2.23, the Product is published with the version number specified. There is a lot more you can do with CLI, and you will learn more about that in Chapter 14, Building Pipelines in API Connect.
Tip
You might encounter errors when executing commands, and being able to troubleshoot them is important. There is the –debug argument that you can append to your commands to get information. But be prepared to get a lot of output.
Summary
In this chapter, you learned a lot about API Connect. You should now be familiar with the components of API Connect and the various deployment models. You have a lot of choices in terms of where to deploy API Connect, and it will certainly get you moving in the right direction on your digital journey.
You were also introduced to the API Connect CLI. The basic commands were provided so that you can utilize them and assist others such as the DevOps team. With the addition of some FHIR swagger files, you were able to walk through an API development flow from its setup to its publication.
You are now ready to learn more about preparing your API Connect topology and organizations so that you can begin building APIs for real. In the next chapter, you will learn how to configure your API Connect environment.