Happy Business Starts Here

Question of the Swagger APIClient

Highlighted
Valued Scholar

Question of the Swagger APIClient

Hi,

I am trying to connect to the Zuora Sandbox using the Swagger Client that has been provided on GitHub (https://github.com/zuora/codelibrary-java)

I am successfully able to connect but when i try to re-use the APIClient Object to fetch the catalog, i am getting an Unauthorized error message.

I am able to successfully post to the endpoint through Postman.

Here's the psuedo code of what i am trying to do,

 public static void main(String[] args) {

 

    ConnectionsApi _api = new ConnectionsApi();

        try {

            CommonResponseType result = _api.pOSTConnections("xxxxx", "xxxx!", "Accept:application/json"); //this is successful

        

            CatalogApi _catapi = new CatalogApi(_api.getApiClient());  //trying to re-use the APIClient from the previous call

 

            

            

            GETCatalogType response = _catapi.gETCatalog();

            System.out.println(response); //this errors out with Unauthorized

 

        } catch (ApiException e) {

            System.err.println("Exception when calling REST API");

            e.printStackTrace();

        }

    }

    

 

Any pointers to what migth be going wrong?

Thanks,

Vimal

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Zuora Alumni

Re: Question of the Swagger APIClient

Hi VKannan

 

Thanks for raising this. At this time, Swagger is used primarily for documentation and is not currently GA for integrations (although we do make it available as is).

 

For your issue, I would dive down in the generated boiler plate and make sure the correct headers are being set.

 

If you have further related questions, let me know and I'll open a ticket and follow up with you.

 

Best,



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

View solution in original post

1 REPLY 1
Highlighted
Zuora Alumni

Re: Question of the Swagger APIClient

Hi VKannan

 

Thanks for raising this. At this time, Swagger is used primarily for documentation and is not currently GA for integrations (although we do make it available as is).

 

For your issue, I would dive down in the generated boiler plate and make sure the correct headers are being set.

 

If you have further related questions, let me know and I'll open a ticket and follow up with you.

 

Best,



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

View solution in original post