List Process API
The following APIs allow you to query and list processes. Examples of a process are models like: Lead, Ticket, FieldVisit.
Note: All the apis accept api key based token authentication and return data within the wrapper { _data:{}, _meta: {}, _errors:[] }
POST /v1/ext/procedure/<procedureShortId>/process/list
You can find the short id for the procedure from the procedures details page (available in admin)
Following are valid examples of the path
POST /v1/ext/procedure/lead/process/list
POST /v1/ext/procedure/ticket/process/list
POST /v1/ext/procedure/fieldvisit/process/list
Request Body
The API accepts a json request body like
{
"where": {
"status": "OPEN",
"state": "NEW",
"createdAt": {
">": "2023-09-01T06:27:30+05:30",
"<": "2023-09-10T06:27:30+05:30",
},
"or": [
"email": "test@example.com",
"phone_number": "7701214822"
]
},
"skip": 0,
"limit": 10
}
supported keys
key | type | notes |
---|---|---|
where | Query type | a query object |
skip | integer | how many process objects to skip, defaults to 0 |
limit | integer | max number of process objects to return. defaults to 10, max is 100 |
Query Object
Following is the type of the where query object
type Query = {
[key: string]: QueryRHS;
or?: Query[];
and?: Query[];
};
type QueryRHS = Record<Operator, any> | string | number | string[] | number[];
type Operator = "=" | "!=" | ">" | ">=" | "<" | "<=";
Query keys can be supported process root fields and process attribute shortIds. Supported root fields are
field | notes |
---|---|
status | can be one of OPEN, COMPLETED or CANCELLED |
state | a state short id |
createdAt | query by the process createdAt field - should be an ISO timestamp |
assignedTo | query by the assignedTo field - has to be a username |
Response Body
{
"_data": [...],
"_meta": {
"hasMore": true,
},
}
The response body's _data
field returns an array of process objects mathcing your list query. The hasMore
flag in _meta
indicates if there are more process objects available. If set to true you will need to query again with the skip
value set to the number of process objects you have already received.