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

Moderator: amosbatto

#812681
There is no REST endpoint to select the language. What do you need it for?

You can create a custom REST endpoint to set the language. For example to set the language to Spanish, you can use this code in your custom endpoint:
Code: Select all
$_SESSION['SYS_LANG'] = 'es';
 
I have created a plugin that you can use to test it:
(23 KiB) Downloaded 88 times
After you import and activate the plugin, you can call it as PUT http://{domain-or-ip}/api/1.0/{workspace}/extrarest/language/{lang}
where {lang} is a variable in the URL, such as:
http://example.com/api/1.0/workflow/ext ... anguage/es
http://example.com/api/1.0/workflow/ext ... uage/pt-BR

You can check the system language with the endpoint GET http://{domain-or-ip}/api/1.0/{workspace}/extrarest/language

Does that work for you?
#812744
jemiris wrote:And one more clarification using rest api sample url :http://example.com/api/1.0/workflow/ext ... uage/pt-BR let's have. Can we set the session in rest api like this $_SESSION['SYS_LANG'] = $lang; will it work
The plugin I gave you has that code:
$_SESSION['SYS_LANG'] = $lang;
Here is relevant code:
Code: Select all
    /**
     * Set the login language in $_SESSION['SYS_LANG']
     * 
     * @url PUT /language/:lang
     * @access protected
     *
     * @param string $lang 
     * 
     * @author Amos Batto <[email protected]>
     * @copyright Public Domain
     */
    public function putSystemLanguage($lang)
    {  
        if (empty($lang) or empty(trim($lang))) {
           throw new Exception("System language cannot be empty.");
        }
        
        $_SESSION['SYS_LANG'] = $lang;
        
        return null;
    } 
    
    /**
     * Get the login language stored in $_SESSION['SYS_LANG']
     * 
     * @url GET /language
     * @access protected 
     * 
     * @author Amos Batto <[email protected]>
     * @copyright Public Domain
     */
    public function getSystemLanguage($lang)
    {  
        if (!isset($_SESSION['SYS_LANG'])) {
           throw new Exception("System language for login session does not exist.");
        }
                
        return $_SESSION['SYS_LANG'];
    }
After you import the plugin, look at the code in the file workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php

okay thanks

Amosbatto, PMUsers.com is down.

It would be nice if ProcessMaker can let us know w[…]

Hi, What is your server config? Is your server Wi[…]

Filtering Grids For Parallel Tasks

Hi, You must create a grid for example @=tempGrid[…]