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);
});
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
<form id="form_1144304" class="appnitro" method="post" action="http://localhost:9090/bonita/API/bpm/process/7111697812078744000/instant... target="_blank">
<input id="folio" name="folio" class="element text medium" type="text" maxlength="255" value="foliaeqrqwerqwer"/>
<input id="descripcion" name="descripcion" class="element text medium" type="text" maxlength="255" value="descripcionvictorcontreras"/>
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</form>
<input id="folio" name="folio" class="element text medium" type="text" maxlength="255" value="foliaeqrqwerqwer"/>
<input id="descripcion" name="descripcion" class="element text medium" type="text" maxlength="255" value="descripcionvictorcontreras"/>
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</form>
Comments
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 :)
regards
ok, i edited my question
Hi,
Did you make any progress by checking the content type of the request?
Thanks