Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中查询Clarizen项目/任务_Php_Project_Task - Fatal编程技术网

在PHP中查询Clarizen项目/任务

在PHP中查询Clarizen项目/任务,php,project,task,Php,Project,Task,我目前正在尝试获取所有Clarizen活动项目的列表,以便修改其任务的某些属性。我读过ClarizenAPI,但它没有很多关于PHP查询的信息。到目前为止,我所做的是查询所有项目,然后逐个测试它们的状态。在实践中,这不是一个好方法,因为我有数千个项目,并且不是所有项目都同时列出。代码如下: //LOGIN PROCCESS $soapUrl = 'https://api.clarizen.com/v1.0/Clarizen.svc?WSDL'; $soapApiUrl = 'http://cla

我目前正在尝试获取所有Clarizen活动项目的列表,以便修改其任务的某些属性。我读过ClarizenAPI,但它没有很多关于PHP查询的信息。到目前为止,我所做的是查询所有项目,然后逐个测试它们的状态。在实践中,这不是一个好方法,因为我有数千个项目,并且不是所有项目都同时列出。代码如下:

//LOGIN PROCCESS
$soapUrl = 'https://api.clarizen.com/v1.0/Clarizen.svc?WSDL';
$soapApiUrl = 'http://clarizen.com/api';

$soapConfig = array('exceptions' => 1);
$request = array();
$params = array(
    'userName' => $username,
    'password' => $password
);


$client = new SoapClient($soapUrl, $soapConfig);
$response = $client->Login($params);
$sessionId = $response->LoginResult->SessionId;
$userId = $response->LoginResult->UserId;

//Create a SOAP header containing the session ID for future requests    
$header = new SoapHeader($soapApiUrl, 'Session', array("ID"=>$sessionId));
$client->__setSoapHeaders($header);

//Create a Query object
$userQuery = new stdClass();
//Set the name of the entity type you are querying
$userQuery->TypeName = 'Project';
//Select the fields you want retrieved from that entity
$userQuery->Fields = array('Name', 'State');


/* Doesnt work...*/
/*
$userQuery->Where = new stdClass();
$userQuery->Where->LeftExpression = new stdClass();
$userQuery->Where->LeftExpression->FieldName = 'State';
$userQuery->Where->Operator = 'Equal';
$userQuery->Where->RightExpression = new stdClass();
$userQuery->Where->RightExpression->Value = new stdClass();
$userQuery->Where->RightExpression->Value->TypeName = 'State';
$userQuery->Where->RightExpression->Value->Value = 'Active';
*/
$request[] = new SoapVar($userQuery, SOAP_ENC_OBJECT, 'EntityQuery', 'http://clarizen.com/api/queries');

//Execute the request
$result = $client->Execute(array("request"=>$request));
3个问题如下:

  • 使用“WHERE”子句在PHP中进行查询的正确方法是什么
  • 例如,如何获取此项目的任务,然后为其创建秒表
  • 如何继续查询,直到hasMore标志为0,或者是否有一种方法可以一次获取整个内容
提前谢谢