Search code examples
command-line-interfaceibm-cloudapiconnectapic

Importing an existing swagger to IBM API Connect and adding it to a product from CLI


I am working on publishing an existing swagger through API Connect. For that, i need to import an existing yaml file (Draft), available in my local folder, and add it to an existing product. However, i find the commands to create an api from scratch. Is there a way i can import a yaml file, having the Assemble Tab" details (x-ibm-configuration:....) and add it to the product and stage the product to the catalog.

apic create --type api -h

Above command only allows to create an api. But i need to import an existing yaml file.

Please suggest.


Solution

  • To push a definition to drafts, use this command ( you can skip the -r if you don't want to replace an existing draft):

    "apic drafts:push "+ apiName +".yaml -r "+ apiName + ':' + apiVersion2Replace +" --organization '${deploymentOrganization}' --server '${deploymentServer}'"