Skip to main content

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

  1. Create a folder to store the library.
Create and activate new folder
mkdir bc-partners-dev
cd bc-partners-dev
  1. Download Apple Business OAS. This will open a new page.

  2. Move the downloaded file to your working directory.

  3. 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.

  4. 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

  1. In a text editor, start a new configuration file - or download the sample configuration file below and edit it.
config_file.json
{
"packageName": "apple_business",
"projectName": "apple_business",
"packageVersion": "1.0.0"
}
  1. Save this file as config_file.json into the folder created at step 1.

  2. If necessary, update packageVersion so the value matches $.info.version in Apple Business OAS that you downloaded above.

  3. Using Terminal, navigate to the folder storing your files.

  4. Copy the following template into Terminal:

Extract Command Template
java -jar swagger-codegen-cli-{version}.jar generate -i business-apis-specification-v1.yaml -l {language} -o {output_folder_name} -c config_file.json
  1. Edit parameters using the language that you prefer and the version number from the Swagger Codegen download above.
Extract Command Example
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
note

Swagger Codegen supports multiple languages and frameworks. Refer to the Swagger Codegen project for more details.

  1. The output folder should now exist and contain the files you generated.

Install Client Libraries

  1. Using Terminal, navigate to the {output_folder_name}. This is client_sdk in our example above.
  2. Type python3 setup.py install and hit enter.
  3. The output folder is now updated to include Python client libraries.
  4. Check using pip3 list and you will see apple-business on the list.

Accept the Sample Software Code License to continue to the code samples.