Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By marcosfpa
#813096
Hi, I'm using the ProcessMaker API to integrate with another web system here from the company. I am using to fetch the endpoint task http://wiki.processmaker.com/3.2/REST_A ... ch.2Fpaged using to log into the API a standard admin user that I have in my PM workspace . Then I filter through the USR_UID. It works.
However I would like to know if it is possible to make filters like this for the endpoint list of cases in draft, which participated, unassigned and start-up tasks?
User avatar
By amosbatto
#813110
You can get most of the lists like this:
/cases/advanced-search/paged?usr_uid={usr_uid}&app_status=TO_DO
/cases/advanced-search/paged?usr_uid={usr_uid}&app_status=DRAFT
/cases/advanced-search/paged?usr_uid={usr_uid}&app_status=CANCELLED
/cases/advanced-search/paged?usr_uid={usr_uid}&app_status=PAUSED
/cases/advanced-search/paged?usr_uid={usr_uid}&app_status=COMPLETED

If you want the participated and unassigned lists for a particular user, then import this plugin:
(27.5 KiB) Downloaded 275 times
The extraRest plugin contains this custom endpoint:
api/1.0/{workspace}/extrarest/cases/user/{user_uid}

For participated cases:
api/1.0/{workspace}/extrarest/cases/user/{usr_uid}?action=sent

For unassigned cases:
api/1.0/{workspace}/extrarest/cases/user/{usr_uid}?action=unassigned

There are many other options, which you can find in the endpoint's source code:
Code: Select all
    /**
     * Return the list of cases for a specified user without being that logged-in user
     * 
     * @url GET /cases/user/:user_uid
     * @access protected
     * 
     * @param string $user_uid User's unique ID. Set to 00000000000000000000000000000000 for logged-in user. {@from path} {@min 32} {@max 32}
     * @param int $start {@from query}
     * @param int $limit {@from query}
     * @param string $action {@from query} {@choice todo,draft,sent,unassigned,paused,completed,cancelled,search,simple_search,to_revise,to_reassign,all,gral,default} 
     * @param string $filter {@from query} {@choice read,unread,started,completed}
     * @param string $search String to search for. {@from query}
     * @param string $pro_uid Process unique ID. {@from query} {@min 32}{@max 32}
     * @param string $app_status Only used if action=search {@from query} {@choice TO_DO,DRAFT,PAUSED,CANCELLED,COMPLETED,ALL}
     * @param string $date_from YYYY-MM-DD {@from query}
     * @param string $date_to YYYY-MM-DD {@from query}
     * @param string $dir Ascending or descending sort order. {@from query} {@choice ASC,DESC}
     * @param string $sort Database field to sort by. {@from query}
     * @param string $cat_uid Category unique ID. {@from query} {@min 32}{@max 32}
     * @param boolean $configuration Set to 1 or 0. {@from query} {@from path}
     * @param boolean $paged Set to 1 or 0. {@from query} {@from path}
     * @param string $newer_than YYYY-MM-DD. Like date_from, but > not >=. {@from query}
     * @param string $older_than YYYY-MM-DD. Like date_to, but < not <=. {@from query}
     * 
     * @return array
     * 
     * @author Amos Batto <amos@processmaker.com>
     * @copyright Public Domain
     */
    public function getCasesForUser(
        $user_uid,                            //for the logged-in user, set to: 00000000000000000000000000000000 
        $start = null,
        $limit = null,
        $action = null, 
        $filter = null,
        $search = null,
        $pro_uid = null,                      //process unique ID
        $app_status = null,                   //only used if $action=='search'
        $date_from = null,
        $date_to = null,
        $dir = null,                          //ASC or DESC
        $sort = "APP_CACHE_VIEW.APP_NUMBER",
        $cat_uid = null,                      //category unique ID
        $configuration = true,                
        $paged = true,
        $newer_than = '',                     //same as $date_from, but > rather than >=
        $older_than = ''                      //same as $date_to, but < rather than <=
    ) {  
        $type = null;                         //not setable parameter
        $callback = null;                     //not setable parameter
        
        $g = new G();
        $g->LoadClass("applications");

        if ($user_uid == 0) {
            $user_uid = $this->getUserId();
        } 
        
        //see Applications::getAll() defined in workflow/engine/classes/class.applications.php
        $oApp = new \Applications();
        $aList = $oApp->getAll(
            $user_uid, 
            $start,
            $limit,
            $action,
            $filter,
            $search,
            $pro_uid,
            $app_status,
            $type,
            $date_from,
            $date_to,
            $callback,
            $dir,
            $sort,
            $cat_uid,
            $configuration,
            $paged,
            $newer_than,
            $older_than
        );
        if ($paged) {
            return $aList;
        } else {
            return $aList['data'];
        }   
    }
What's SAP FICO?

Trustworthy and skill-building, each of these actu[…]

To convert MBOX to PST, start by downloading and i[…]

My Assignment Services stands out as one of the be[…]

Erectile Dysfunction, commonly known as impotence,[…]