API Connect

 View Only
  • 1.  Moving using APIC CLI to REST API

    Posted 16 days ago

    Hello,

    We have been using APIC CLI to configuration applications and planning to move to using REST APIs. We are using on-prem APIC v10.0.5.7, can you point me to documentation for the below commands. I tried using --debug option as per this blog , but did not get the REST API output.

    apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url <xxxx>--template tst-api.hbs --product "tst-product"
    apic validate tst-product.yaml
    apic products:publish --scope space tst-product.yaml --server <xxxx> --org <xxxx> --catalog <xxxx> --space <xxxx>
    apic apis:get tst-api:2.0.0 --server <xxxx> --org <xxxx> --catalog <xxxx> --scope <xxxx> --space <xxxx>
    apic draft-products:create tst-product.yaml --server <xxxx> --org <xxxx>
    apic draft-products:update tst-product:2.0.0 tst-product.yaml --server <xxxx> --org <xxxx>
    apic subscriptions:create --server <xxxx> --org <xxxx>--catalog <xxxx> --space <xxxx> --consumer-org <xxxx> --app <xxxx> subscription.json
    apic logout --server <xxxx>

    Thanks
    Raj



    ------------------------------
    Dhanraj Uchil
    ------------------------------


  • 2.  RE: Moving using APIC CLI to REST API

    Posted 15 days ago
    Edited by Nick Cawood 15 days ago

    Comment deleted.

    Posted in error.  Please ignore.

    ------------------------------
    Nick Cawood
    API Connect Consultant
    IBM Expert Labs
    IBM UK Ltd

    https://www.linkedin.com/in/nickcawood/
    ------------------------------



  • 3.  RE: Moving using APIC CLI to REST API

    Posted 13 days ago

    Hi,

    --debug works most of the time for us.

    can you show the logs from e.g. the command?

    apic products:publish --scope space tst-product.yaml --server <xxxx> --org <xxxx> --catalog <xxxx> --space <xxxx> --debug



    ------------------------------
    Jeroen Willems
    Integration Architect - Managing Partner
    Integration Designers
    ------------------------------



  • 4.  RE: Moving using APIC CLI to REST API

    Posted 16 hours ago

    Hi Jeroen,

    I have tired the --debug with all commands, the command works fine with no error, but there is not output. 

    apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url <xxxx>--template tst-api.hbs --product "tst-product"
    apic validate tst-product.yaml --debug


    Also, use `--format json` or `--format yaml` on all CLI commands as you will get far more content back, both when commands are successful and when errors occur. 

    apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url https://tst.bcbsnc.com --template tst-api.hbs --product "tst-product" --format json --debug

    Error: unknown flag: --format

    I am running these commands in Amazon Linux docker container.

    Thanks
    Raj



    ------------------------------
    Dhanraj Uchil
    ------------------------------



  • 5.  RE: Moving using APIC CLI to REST API

    Posted 16 hours ago

    afaik apic create:api & apic validate are commands that run locally in the toolkit (cli), so no rest api's are called here.

    can you provide the output for

    apic products:publish --scope space tst-product.yaml --server <xxxx> --org <xxxx> --catalog <xxxx> --space <xxxx> --debug 



    ------------------------------
    Jeroen Willems
    Integration Architect - Managing Partner
    Integration Designers
    ------------------------------



  • 6.  RE: Moving using APIC CLI to REST API

    Posted 15 hours ago
    $ apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url https://tst.nc.com --template tst-api.hbs --product "tst-product" --debug
    Created tst-api.yaml API definition [tst-api:2.0.0]
    Created tst-product.yaml product definition [tst-product:1.0.0]
    
    $ apic validate tst-product.yaml --debug
    Validated tst-product.yaml product definition [tst-product:1.0.0]
    Validated tst-api.yaml API definition [tst-api:2.0.0]
    
    
    Without --debug flag
    $ apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url https://tst.nc.com --template tst-api.hbs --product "tst-product" 
    Created tst-api.yaml API definition [tst-api:2.0.0]
    Created tst-product.yaml product definition [tst-product:1.0.0]
    
    $ apic validate tst-product.yaml
    Validated tst-product.yaml product definition [tst-product:1.0.0]
    Validated tst-api.yaml API definition [tst-api:2.0.0]
    
    
    With --format and --debug flag
    $ apic create:api --title "tst-api" --name tst-api --version 2.0.0 --basepath /test --target-url https://tst.nc.com --template tst-api.hbs --product "tst-product" --format json --debug
    
    Error: unknown flag: --format


    ------------------------------
    Dhanraj Uchil
    ------------------------------



  • 7.  RE: Moving using APIC CLI to REST API

    Posted 5 hours ago

    The commands listed above do not have any output, just responses.
    For example if you try to list or get something this will have an output which you can format with the --format options and will show debug information with the --debug parameter.

    Try these commands to see the differences:

    ./apic products:list-all --catalog <CATALOG> --org <PORG> --server <SERVER> --scope catalog

    ./apic products:list-all --catalog <CATALOG> --org <PORG> --server <SERVER> --scope catalog --debug

    ./apic products:list-all --catalog <CATALOG> --org <PORG> --server <SERVER> --scope catalog --debug --format json

    ./apic products:list-all --catalog <CATALOG> --org <PORG> --server <SERVER> --scope catalog --debug --format yaml

    The --debug parameter will show the equivalent cURL command being used by the Toolkit including the Bearer Token and API call & headers used.



    ------------------------------
    Nick Cawood
    API Connect Consultant
    IBM Expert Labs
    IBM UK Ltd

    https://www.linkedin.com/in/nickcawood/
    ------------------------------