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

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

<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>

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