Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By stevenmjm
#812686
I'm trying to start a case using the api and I'm trying to do this from a phone gap application with javascript. I was able to authenticate a user with the api like so.
Code: Select all
$.post("http://192.168.0.5:80/medres/oauth2/token", {
        dataType: 'json',
        grant_type: 'password',
        scope: '*',
        client_id: 'client_id',
        client_secret: 'client_secret',
        username: 'user',
        password: 'password'
    }, function(data){
        console.log(data);
        var d = new Date();
        d.setTime(d.getTime() + 60*60*1000);
        document.cookie = "access_token="  + data.access_token  + "; expires=" + d.toUTCString();
        document.cookie = "refresh_token=" + data.refresh_token; //refresh token doesn't expire 
    })
But when i try to start a case with this.
Code: Select all
$.post('http://192.168.0.5/api/1.0/medres/cases', {
                        access_token: getCookie('access_token'),
                        pro_uid: '3827944695a42a7990f0655045007841',
                        tas_uid: 'sme-129625a4d1cc557f110087068990',
                        variables: {
                           'data': object
                        }
                    }, function(data){
                        console.log(data)
                    })
It always report back with
Code: Select all
{"error":{"code":400,"message":"Bad Request: Task invalid or the user is not assigned to the task"}}
or
Code: Select all
{"error":{"code":400,"message":"Bad Request: Invalid value specified for: tas_uid"}}
I've tried using many different start events for the tas_uid, but nothing has worked for me so far.

Is there a certain start event that i need to use? or am i going about this the completely wrong way? please help :?
Last edited by stevenmjm on Wed Jan 03, 2018 3:41 pm, edited 1 time in total.
By stevenmjm
#812689
Welp it looks like I made some progress..

I changed my start event to an empty. and change the tas_uid to that of the first step and now everything seems fine ^_^
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]