Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Hello, whenever i try to use the REST API to generate an output document, i get the following error.

{"error":{"code":400,"message":"Bad Request: The user with \"00000000000000000000000000000001\" not have permissions to perform this action."}}

This REST function only seems to work for the user user account in which the the output document was originally generated. Is this the default behavior or is there some way to allow the Administrator or Supervisor to generate an output document through the REST API. Thanks.

Im using Processmaker 3.2 Community.
If you want to allow Process Supervisors to generate Output Documents, edit the file workflow/engine/src/ProcessMaker/Services/Api/Cases/OutputDocument.php and change the doPostOutputDocument() function so it has the following code:
Code: Select all
     * @url POST /:app_uid/:del_index/output-document/:out_doc_uid
     * @param string $app_uid     {@min 32}{@max 32}
     * @param int    $del_index   {@min 1}
     * @param string $out_doc_uid {@min 32}{@max 32}
    public function doPostOutputDocument($app_uid, $del_index, $out_doc_uid)
        try {
            $userUid = $this->getUserId();

            $case = new \ProcessMaker\BusinessModel\Cases();
            $outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
            //allow user to create output document if a process supervisor or is assigned to case:
            $aCaseInfo = $case->getApplicationRecordByPk($app_uid, [], false);
            $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
            if ($supervisor->isUserProcessSupervisor($aCaseInfo['PRO_UID'], $userUid) === false) {
                $outputDocument->throwExceptionIfCaseNotIsInInbox($app_uid, $del_index, $userUid);
            $outputDocument->throwExceptionIfOuputDocumentNotExistsInSteps($app_uid, $del_index, $out_doc_uid);
            $response = $outputDocument->addCasesOutputDocument($app_uid, $out_doc_uid, $userUid);

            return $response;
        } catch (\Exception $e) {
            throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());

I use PM 3.4. Android push works while IOS push do[…]

[quote=ziadeh post_id=823031 time=1550759948 user_[…]

I have to support reports in processmaker 3.4. A s[…]

The link no longer exists because PM only supports[…]