Rest api Start a process using an instantiation contract gives 415 Unsupported Media Type

Hi…

I am trying to use REST for start process but bonita returns error 415 Unsupported Media Type. I am using jquery for do it

function startProcess (idProceso) {
alert('Iniciando el proceso : ’ + idProceso);
var jqxhr = $.post(‘http://localhost:9090/bonita/API/bpm/process/’ + idProceso + ‘/instantiation’, { folio: ‘FolioJQUERY’, descripcion: ‘descJQUERY’ } , function() {
// do call back
}).done(function(dato) {
alert( “proceso iniciado” );
console.log(dato);
})
.fail(function(dato) {
alert( “error” );
console.log(dato);
})
.always(function(dato) {
alert( “finished” );
console.log(dato);
});

console.log(jqxhr);
}

I did a second test whit a normal html FORM, but I got the same error 415

the problem was that javascript chage the process id number, i think is too big, and it invoke a diferent and unexisting process, the solution was to convert the parameter in a string, thanks

Hi,

I did the test quickly using the form. It doesn’t work either, which is normal I guess. With the form, you can’t set the content type of the request. And if you check with a debugguer, the call generated by the portal has the following the content type: application/json;charset=UTF-8

I’m not sure that is the main cause, but it’s probably a good start. Can you set the content type using your JQuery request?

Thanks

A tip for trying to show code correctly, don’t use Bonita’s buttons but surround the code with

< code >
< /code >

removing the spaces (I had to put them in otherwise you’d not see the tip :slight_smile:

regards

ok, i edited my question

Hi,

Did you make any progress by checking the content type of the request?

Thanks