Page 1 of 1

HTTP STATUS 400 ON PMTABLES filter query API

Posted: Mon May 20, 2019 3:17 am
by hmdshariati
When I'm using processmaker api to query pmtables according to the https://wiki.processmaker.com/3.1/REST_ ... ing_Filter and filter them like this:
Code: Select all
    $url  = "/api/1.0/toranj/pmtable/" . $tourlist . '/data?q= {"where": {"tourname": "tr456"}}';
    $oRet = pmRestRequest("GET",$url, null, $oauthToken->access_token);
actually request this url: /api/1.0/[workspacename]/pmtable/[pmtableuid]/data?q= {"where": {"tourname": "tr456"}}
the result return no response:
Code: Select all
object(stdClass)[403]
  public 'response' => null
  public 'status' => int 400
but there is a row with this specific query in database.
I'm using bitnami processmaker enterprise 3.2:
Code: Select all
ProcessMaker Ver.
3.2.3 - Enterprise Edition
PMUI JS Lib. Ver.
0.1.1
MAFE JS Lib. Ver.
release/3.2.3.a44fbc3
PM Dynaform JS Lib. Ver.
release/3.2.3.c450379
Upgrades/PatchesNever upgraded
how can I solve the problem?

Re: HTTP STATUS 400 ON PMTABLES filter query API

Posted: Tue May 21, 2019 2:08 am
by amosbatto
You need to get rid of the spaces in your URL.
This code worked for me:
Code: Select all
function getPmTableSearch($oToken) {
	$tableId = '6030376055c6375a3334329095826979';
	$url = '/api/1.0/workflow/pmtable/'.$tableId.'/data?q={"where":{"FILENAME":"CommentsInWiki.odt"}}';
	$oRet = pmRestRequest("GET", $url, null, $oToken->access_token);
	print "\n\n".json_encode($oRet->response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n\n";
}
If you need a space, then use %20 in place of the space.

Re: HTTP STATUS 400 ON PMTABLES filter query API

Posted: Tue May 21, 2019 2:37 am
by amosbatto
I updated the documentation to remove the spaces in the examples.