$aUsers = json_decode ( curl_exec ( $ch ) ) $accessToken ) ) Ĭurl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true ) "/api/1.0/workflow/users" ) Ĭurl_setopt ( $ch, CURLOPT_HTTPHEADER, array ( "Authorization: Bearer ". $accessToken = isset ( $_COOKIE ) ? $_COOKIE : getAccessToken ( ) $pmServer = "" //set to your ProcessMaker address It is recommended to check whether the JSON object exists before calling the JSON.parse() method: For older browsers, eval() needs to be used, although it is not as safe. In JavaScript, the JSON.parse() function can be used to decode JSON strings if using a recent web browser that supports JSON (Internet Explorer 8+, Firefox 3.1+, Chrome 3+, Safari 4.0.3+ and Opera 10.5+). In PHP, the response value can be decoded using json_decode(). ProcessMaker REST endpoints have response values that will return JSON (JavaScript Object Notation) strings, which need to be decoded. It is a good idea to always check whether a REST request was successful after executing it. When a REST request is successful, it will set the HTTP status code to 200 (OK) or 201 (Created). Using this function will simplify your code and help avoid duplication and errors. This page explains how to call REST endpoints using PHP, standard JavaScript and JQuery (which is a library of JavaScript).īecause there is a lot of code involved in sending out each HTTP request and processing the response, it is recommended to create a custom function named pmRestRequest() that will handle the REST requests. Once an access token is obtained from OAuth2.0, the ProcessMaker REST endpoints can be called using that access token. Executing pmRestRequest() Synchronously.Executing pmRestRequest() Asynchronously.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |