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

1
0
-1

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

  1. function startProcess (idProceso) {
  2. alert('Iniciando el proceso : ' + idProceso);
  3. var jqxhr = $.post('http://localhost:9090/bonita/API/bpm/process/' + idProceso + '/instantiation', { folio: 'FolioJQUERY', descripcion: 'descJQUERY' } , function() {
  4. // do call back
  5. }).done(function(dato) {
  6. alert( "proceso iniciado" );
  7. console.log(dato);
  8. })
  9. .fail(function(dato) {
  10. alert( "error" );
  11. console.log(dato);
  12. })
  13. .always(function(dato) {
  14. alert( "finished" );
  15. console.log(dato);
  16. });
  17.  
  18. console.log(jqxhr);
  19. }

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

  1. <form id="form_1144304" class="appnitro" method="post" action="http://localhost:9090/bonita/API/bpm/process/7111697812078744000/instantiation" target="_blank">
  2. <input id="folio" name="folio" class="element text medium" type="text" maxlength="255" value="foliaeqrqwerqwer"/>
  3. <input id="descripcion" name="descripcion" class="element text medium" type="text" maxlength="255" value="descripcionvictorcontreras"/>
  4. <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
  5. </form>

Comments

Submitted by Lionel Palacin on Wed, 07/13/2016 - 23:55

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

Submitted by Sean McP on Thu, 07/14/2016 - 04:38

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

Submitted by mix4 on Thu, 07/14/2016 - 20:35

ok, i edited my question

Submitted by Lionel Palacin on Wed, 07/20/2016 - 04:44

Hi,

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

Thanks

1 answer

1
0
-1
This one is the BEST answer!

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

Notifications