Post

2 followers Follow
0
Avatar

WebAPI clarizen client does not have a Query method!

Hi,

So I am using this as a guide. 

https://success.clarizen.com/hc/en-us/articles/205711818-16-12-Web-Service-API-Guide-Version-2

This works no problem:

static void Main(string[] args)

{

//Create a proxy to the Clarizen Web Service

clarizenClient = new Clarizen();

clarizenClient.Timeout = 60 * 1000;

//Enhance performance by compressing traffic

clarizenClient.EnableDecompression = true;

//Set your applicationId if applicable

LoginOptions options = new LoginOptions();

options.ApplicationId = "Sample c# client";

//Contact the login server to get the URL of your data center

GetServerDefinitionResult srvDef = clarizenClient.GetServerDefinition(userName, password, options);

//Change the SOAP client endpoint to use the new URL

clarizenClient.Url = srvDef.ServerLocation;

//Call the Login method

LoginResult lr = clarizenClient.Login(userName, password, options);

}

But this sample code does NOT work: the client object does NOT have a .Query method... what am I missing?

 

MyWorkItemsQuery query = new MyWorkItemsQuery();

query.ItemsType = WorkItemType.Task;

query.ItemsTypeSpecified = true;

query.ItemsFilter = WorkItemFilter.IAmAManager;

query.ItemsFilterSpecified = true;

query.ItemsState = WorkItemState.Active;

query.ItemsStateSpecified = true;

query.Fields = new string[]

{

"Name",

"Importance",

"DueDate",

"StartDate",

"PercentCompleted"

};

QueryResult qr = client.Query(query);

Denis

Denis Doiron Answered

Please sign in to leave a comment.

3 comments

1
Avatar

Hi Denis,

The Query method is no longer supported (we need to update the documentation).

Use the Execute method instead. Notice that the input is an array of messages and the output is an array of results. 

Hope this helps,

Ophir

Ophir Kenig 1 vote
Comment actions Permalink
0
Avatar

Yes, I would really have to agree. 

Keeping the basic guide up to date with your API would be a very good Idea.

Now, I have tried to look at the EXECUTE method as well as Message but I dont find any documentation that seems to help.

How, specifically, to I retrieve a list of projects/tasks using the EXECUTE method?

Denis

Denis Doiron 0 votes
Comment actions Permalink
0
Avatar

Hi Denis,

The documentation has a sample for using Execute (with RetrieveMessage, but it would work for a query as well)

The code should look similar to this:

BaseMessage[] messages = new BaseMessage[] { query };

QueryResult result = (QueryResult)client.Execute(messages)[0];

 

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink