Create case with api rest

Hello everyone.
I want to create a case with the rest api.
First I log in ok with http://localhost:8080/bonita/loginservice and get the cookies

Then I try to create the case with a POST to the url
http://localhost:8080/pretty/API/bpm/case

using postman. It returns a status code 401 unauthorized.
This is the postman code

var axios = require('axios');
var data = JSON.stringify({
  "processDefinitionId": "7612481195189194033",
  "variables": [
    {
      "name": "performanceContract",
      "value": [
        {
          "name": "montantAvance",
          "value": "150"
        },
        {
          "name": "modePerception",
          "value": "Virement"
        }
      ]
    }
  ]
});

var config = {
  method: 'post',
  url: 'http://localhost:8080/bonita/API/bpm/case',
  headers: {
    'Content-Type': 'application/json',
    'Cookie': 'pretty.tenant=1; BOS_Locale=en; JSESSIONID=2B622A17A403683551A58FF87AC47CB3; X-Pretty-API-Token=ccf7c15f-d8ec-4a2c-a0e8-c87e4dd28673'
  },
  date : date
};
any help available?

Hi  weglineduardo,

I have checked and documentation it was not pointing to the right page for the case that you're trying to achieve. We're currently fixing the links.

Please refer to: https://documentation.bonitasoft.com/bonita/2022.2/api/actors-process-connectors-api#start-a-process-using-an-instantiation-contract

  • Use POST /API/bpm/process/:processId/instantiation
  • Be sure to add both headers JSESSIONID and X-Bonita-API-Token to your request.

I've tried using postman and it is working for me. Hope this helps!

As confirmed, here, this is the best answer: https://community.bonitasoft.com/node/37958#node-38034