getting_started
Apple Business OpenAPI Specification (OAS)
The Apple Business API is specified by an OpenAPI Specification (OAS) description. OAS is an industry standard for describing an Application Programming Interface (API).
Generating Client Libraries
Swagger Codegen is an automated tool that generates a library automatically in any of several languages based on an OAS. The instructions below tell how to generate this library from the Apple Business OAS.
Prerequisites
-
Check that your system has the target language that you want to use. The examples below use Python 3, which is available from Python downloads page.
-
You will need a current version of Java to use the extractor. This is available from Java downloads page.
Set Up and Download
- Create a folder to store the library.
mkdir bc-partners-dev
cd bc-partners-dev
-
Download Apple Business OAS. This will open a new page.
-
Move the downloaded file to your working directory.
-
Download the version 3.0.68 Swagger Codegen. Click on the version number, find the download of type "jar" (Java Archive), and click to download.
-
Note the version number of the Swagger Codegen. You will need it for the configuration file below. This will be the second version number in the file shown below the Apple Business information. (The first version number applies to the OpenAPI Spec.)
Configuration
- In a text editor, start a new configuration file - or download the sample configuration file below and edit it.
{
"packageName": "apple_business",
"projectName": "apple_business",
"packageVersion": "1.0.0"
}
-
Save this file as
config_file.jsoninto the folder created at step 1. -
If necessary, update
packageVersionso the value matches$.info.versionin Apple Business OAS that you downloaded above. -
Using Terminal, navigate to the folder storing your files.
-
Copy the following template into Terminal:
java -jar swagger-codegen-cli-{version}.jar generate -i business-apis-specification-v1.yaml -l {language} -o {output_folder_name} -c config_file.json
- Edit parameters using the language that you prefer and the version number from the Swagger Codegen download above.
java -jar swagger-codegen-cli-3.0.68.jar generate -i business-apis-specification-v1.yaml -l python -o client_sdk -c config_file.json
Swagger Codegen supports multiple languages and frameworks. Refer to the Swagger Codegen project for more details.
- The output folder should now exist and contain the files you generated.
Install Client Libraries
- Using Terminal, navigate to the
{output_folder_name}. This isclient_sdkin our example above. - Type
python3 setup.py installand hit enter. - The output folder is now updated to include Python client libraries.
- Check using
pip3 listand you will seeapple-businesson the list.
Accept the Sample Software Code License to continue to the code samples.