- Wed Jan 03, 2018 2:44 pm
#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.
Is there a certain start event that i need to use? or am i going about this the completely wrong way? please help
Code: Select all
But when i try to start a case with this.
$.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
})
Code: Select all
It always report back with
$.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)
})
Code: Select all
or
{"error":{"code":400,"message":"Bad Request: Task invalid or the user is not assigned to the task"}}
Code: Select all
I've tried using many different start events for the tas_uid, but nothing has worked for me so far.{"error":{"code":400,"message":"Bad Request: Invalid value specified for: tas_uid"}}
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.