Deploy
This operation deploys the build to API Gateway.
Syntax
apic deploy [options][projects]
projects. Specifies the projects in the local folder you want to deploy. You can provide multiple projects by providing comma separated project names as input.
The following table lists all available options for the apic deploy command and their descriptions.
| Options | Description |
|---|---|
| -l, --localDir | Path of the local folder of the specified studio projects. |
| -a, --all | Use --all to include all projects in the given local directory. If you do not want to build all projects in the given local directory, then specify the project name that is required. |
| -n, --names | Specify the api kind in the format namespace:apiname:version. You can provide multiple asset names as comma separated entries as input. Studio supports only API assets. |
| -a, --archive archive | Specify the archive to be deployed. |
| -t, --target target | Specify the endpoint of the API Gateway instance to which the asset has to be deployed. This is a mandatory argument. |
| -u, --username username | Provide the username of the API Gateway instance to which the asset is deployed. This user must have Manage APIs functional privilege. This is a mandatory argument. |
| -pwd, --password password | Provide the password of the API Gateway instance to which the asset is deployed. If you do not provide the password, CLI prompts for the password, where you can provide the masked password. |
| -ow, --overwrite | Specify if you want to overwrite the existing assets on the API Gateway instance where the specified asset is being deployed. |
| -d, --debug | Enables the debug mode. |
| -h, --help | Displays help for the build command. |
1. Deploying a single project
Syntax
apic deploy Projectname --localDir local_dir_path
--target "http://host:port"
--username username --password password --overwrite
Example
apic deploy Project1 --localDir /Users/user1/Desktop/apistudio_localdir
--target "http://host:port"
--username "******" --password "******" --overwrite
Deploys a single project file, Project1, located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. If there is any identical asset in the API Gateway instance then the overwrite argument helps in overwriting that asset.
Outcome
As the deployment progresses, it lists the asset being added followed by deployment status of the asset. On successful deployment you will see the deployment success message Deployment to api gateway is successful!. In addition the gateway endpoints of the APIs in the project is displayed.
In case of any errors, a deployment failure message with the reason for failure is displayed so you can take the corrective action.
2. Deploying multiple projects
Syntax
apic deploy Projectname1,Projectname2
--localDir local_dir_path
--target "http://host:port"
--username username --password password --overwrite
Example
apic deploy Project1,Project2 --localDir /Users/user1/Desktop/apistudio_localdir
--target "http://host:port"
--username "******" --password "******" --overwrite
Deploys two projects from two project files, Project1 and Project2, located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. If there is any identical asset in the API Gateway instance then the overwrite argument helps in overwriting that asset.
Outcome
As the deployment progresses, it lists the assets being added followed by deployment status of the assets. On successful deployment you will see the deployment success message Deployment to api gateway is successful!. In addition the gateway endpoints of the APIs in the projects is displayed.
In case of any errors, a deployment failure message with the reason for failure is displayed so you can take the corrective action.
3. Deploying all projects
Syntax
apic deploy --all --localDir local_dir_path
--target "http://host:port"
--username username --password password --overwrite
Example
apic deploy --all --localDir /Users/user1/Desktop/apistudio_localdir
--target "http://host:port"
--username "******" --password "******" --overwrite
Deploys all projects located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. If there is any identical asset in the API Gateway instance then the overwrite argument helps in overwriting that asset.
Outcome
As the deployment progresses, it lists the assets being added followed by deployment status of the assets. On successful deployment you will see the deployment success message Deployment to api gateway is successful!. In addition the gateway endpoints of the APIs in the project is displayed.
In case of any errors, a deployment failure message with the reason for failure is displayed so you can take the corrective action.
4. Deploying an API
Syntax
apic deploy Projectname1 --names namespace:name:version
--localDir local_dir_path --target "http://host:port"
--username username --password password --overwrite
Example
apic deploy Project1 --names dev:TestPayments:1.0
--localDir '/Users/user1/Desktop/apistudio_localdir' --target 'http://host:port'
--username "******" --password "******" --overwrite
Deploys an API specified by its name dev:TestPayments:1.0, located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. If there is any identical asset in the API Gateway instance then the overwrite argument helps in overwriting that asset.
Outcome
As the deployment progresses, it lists the asset being added followed by deployment status of the assets. On successful deployment you will see the deployment success message Deployment to api gateway is successful!. In addition the gateway endpoint of the API is displayed.
In case of any errors, a deployment failure message with the reason for failure is displayed so you can take the corrective action.
5. Deploying an archive
Syntax
apic deploy --archive path_to_archive.zip
--target "http://host:port"
--username username --password password --overwrite
Example
apic deploy --archive /Users/user1/Desktop/apistudio_localdir/build.zip
--target "http://host:port" --username "******" --password "****"
--overwrite
Deploys an archive, build.zip, located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. If there is any identical asset in the API Gateway instance then the overwrite argument helps in overwriting that asset.
The build.zip archive in the local directory is generated using the apic build
command. This command builds and archives the specified project assets, including any external
dependencies referenced by the APIs, as long as they are available in the local folder. For more
information on building archives, see Build.
Outcome
As the deployment progresses, it lists the assets being added followed by deployment status of the assets. On successful deployment you will see the deployment success message Deployment to api gateway is successful!. In addition the gateway endpoints of the APIs in the project is displayed.
In case of any errors, a deployment failure message with the reason for failure is displayed so you can take the corrective action.