REST API client library

ckuo Advanced Tutor

Advanced Tutor

Advanced Tutor
Posts: 1
Registered: ‎12-08-2017

REST API client library



We are switching from SOAP to REST, and are trying out the generated client side API library.

The sample code in does not explain how to establish the connections. 

In my experiment I had tried ConnectionsApi to make sure my credential works. 

However in the following code snippet I got a failed response. 


here is my sample code 
ApiClient client = new ApiClient(ZOptions.gZuoraRESTEndpoint); // set the base path to sandbox 
Configuration configuration = new Configuration(client); 
configuration.Username = ZOptions.gZuoraUsername; 
configuration.Password = ZOptions.gZuoraEncryptedPassword;

AccountsApi accountsApi = new AccountsApi(configuration); 
GETAccountType account = accountsApi.GETAccount(ACCOUNT_NUMBER); 

I got

Error calling GETAccount: { 
"success" : false, 
"reasons" : [ { 
"code" : 90000011, 
"message" : "this resource is protected, please sign in first" 
} ] 

How does one establish the connection and be authenticated?


Thank you for your help!