entityQuery
Url
/V2.0/services/data/entityQuery
HTTP Method
GET,POST
Description
Retrieve entities from Clarizen according to a certain criteria 
Parameters
Name Type Description
typeName* string The main entity type to query (e.g. WorkItem, User etc.)
fields string[] A list of field names to retrieve
orders orderBy[] Optionaly order the result
where condition The query criteria
relations relation[] The query relations
deleted boolean If set to true, the query is performed on Deleted entities
originalExternalID boolean
paging paging Paging setting for the query
Result
An object containing the results from a query
Name Type Description
entities entity[] Array of entities returned from this query
paging paging Paging information returned from this query. If paging.hasMore is true, this object should be passed as is, to the same query API in order to retrieve the next page
In case of failure an error object will be returned
* indicates required fields
Samples
The following example shows how to perform a query that retrieves the Name, Manager and DueDate of tasks whose state is either Active or Draft and are managed by a certain user. The result will be sorted by the Name field and will return 50 results.

POST /V2.0/services/data/entityQuery

{
    "typeName": "Task",
    "fields": ["Name","Manager.Name","DueDate"],
    "orders": [{
        "fieldName": "Name", 
        "order": "Descending"
        }],
    "paging": {"limit": 50},
    "where": {
        "and": [
            {
                "leftExpression":{ "fieldName": "Manager"},
                "operator": "Equal",
                "rightExpression": { "value": "/User/9bcd7df3-4f6b-4272-944c-219b65b7862a" }
            },
            {
                "or": [
                {
                    "leftExpression":{ "fieldName": "State"},
                    "operator": "Equal",
                    "rightExpression": { "value": "Active" }
                },
                {
                    "leftExpression":{ "fieldName": "State"},
                    "operator": "Equal",
                    "rightExpression": { "value": "Draft" }
                }
                ]
            }            
        ]
    }
}        
Response:
{
  "entities": [
    {
      "id": "/Task/3a69f9cc-795d-4954-be47-5010f42a3621",
      "Name": "X Task",
      "Manager": {
        "id": "/User/9bcd7df3-4f6b-4272-944c-219b65b7862a",
        "Name": "Sam"
      },
      "DueDate": "2014-10-13T08:00:00.0000000"
    },
...
...   
    {
      "id": "/Task/7e96ac27-b983-4726-92a5-ff10800d90ab",
      "Name": "A Task",
      "Manager": {
        "id": "/User/9bcd7df3-4f6b-4272-944c-219b65b7862a",
        "Name": "Sam"
      },
      "DueDate": "2007-08-30T16:00:00.0000000"
    }
  ],
  "paging": {
    "from": 25,
    "limit": 50,
    "hasMore": false
  }
}