Post

2 followers Follow
0
Avatar

Need help with Query in WebService API

Hi Devs,

First time trying to connect to Clarizen API. I am using the WebService with C#.

I am able to connect but the documented examples for querying the objects do not work. Has anyone gotten the query to work?

Here is what I have to date. 

 

ClarizenSvc.ClarizenClient clarizenClient;
//Create a proxy to the Clarizen Web Service

clarizenClient = new ClarizenSvc.ClarizenClient();
ClarizenSvc.LoginOptions options = new ClarizenSvc.LoginOptions();
ClarizenSvc.LoginResult lr;
options.ApplicationId = "Sample c# client";

clarizenClient.Login("myemail", "mypassword", options, out lr);

string results = "";
if( lr.Success )
{
ClarizenSvc.EntityQuery customersQuery = new ClarizenSvc.EntityQuery();

customersQuery.TypeName = "Customer";

// Retrieve only name of each customer
ClarizenSvc.stringList sl = new ClarizenSvc.stringList();
sl.Add("Name");
customersQuery.Fields = sl;

 

// I HAVE NO IDEA WHAT TO DO NOW... 

// THIS DOCUMENTED LINE DOES NOT WORK!

QueryResult qr = clarizenClient.Query(query);

 

}
else
{
results = lr.Error.Message;
}

Denis Doiron Answered

Please sign in to leave a comment.

2 comments

2
Avatar

Hi Denis,

 

It seems you added the proxy as a service reference, rather than a web reference. 

The examples provided are based on the Web Reference proxy, and the parameters for the calls are different.

Please follow the instructions on the documentation carefully, particularly for adding the web reference proxy, and match your code to the one on the documentation. 

Hope this helps,

Ophir

 

Ophir Kenig 2 votes
Comment actions Permalink