# REST API for Bonita 7.0.0

**URL:** <https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134>\
**Category:** Q&A\
**Created:** [13 July 2015 13:49 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134 "2015-07-13T13:49:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ag00367508](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ag00367508](https://community.ofelia.com/u/ag00367508)\
**Post date:** [13 July 2015 13:49 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/1 "2015-07-13T13:49:43Z")

</div>

Hi,

I am new to Bonita BPM. I have managed to create a process and run it successfully thru Bonita Studio.

But i am not able to start the process instance using REST APIs ([http://localhost:1904/bonita/API/runtimeAPI/instantiateProcessWithVariables/EmployeeInformation--1.0](http://localhost:1904/bonita/API/runtimeAPI/instantiateProcessWithVariables/EmployeeInformation--1.0)). It gives 401 error. On searching the net on this issue found that we need to configure REST details in JAAS, but not able to get thru even after configuring JAAS.

Also there is mention of bonita-server-rest.war in many of the replies on similar issue, but couldnt really find this war for 7.0.0 version. Not sure if its still valid for this version.

Can anybody please guide me thru on how to make REST APIs work?

Thanks in advance.

Anant

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [13 July 2015 16:05 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/2 "2015-07-13T16:05:28Z")

</div>

Hi,

To start an instance of a process (aka. **case** ) you should use the following REST API resource:

```
POST | /bonita/API/bpm/case
```

If you don’t need to specify variables then you should be good with this payload:

```
{ "processDefinitionId":"5777042023671752656" }
```

Otherwise you should send something like:

```
{  
   "processDefinitionId":"5777042023671752656",
   "variables":[  
      {  
         "name":"stringVariable",
         "value":"aValue"
      },
      {  
         "name":"dateVariable",
         "value":349246800000
      },
      {  
         "name":"numericVariable",
         "value":5
      }
   ]
}
```

REST API documentation for the **case** resource can be found here: [http://documentation.bonitasoft.com/bpm-api-1#case](http://documentation.bonitasoft.com/bpm-api-1#case)

I would try with this resource before digging further with custom JAAS configuration.

## Hope this helps.

Truc

---

<div class="post-metadata">

**Author:** ![ag00367508](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ag00367508](https://community.ofelia.com/u/ag00367508)\
**Post date:** [14 July 2015 05:45 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/3 "2015-07-14T05:45:19Z")

</div>

Hi Truc,

Thanks a lot for your reply.

I tried your suggestion, but its still giving 401 error. I think there is no issue in the way REST APIs are being called, but i am missing some configuration at my server end that enables the REST server to accept the request.

I even tried using basic authorization using restuser / restbpm credentials but its still the same.

Regarding the JAAS configuration, i read in many replies that there a need to make the below entry to make REST APIs able to accept the requests

BonitaRESTServer {  
org.ow2.bonita.identity.auth.BonitaRESTServerLoginModule required logins=“restuser” passwords=“restbpm” roles=“restuser”;  
};

I tried putting this entry in \<BPM\_Studio\_Home\>\workspace\tomcat\bonita\client\platform\conf\jaas-standard.cfg file as well, but still not able to get thru.

Any other suggestions please?

Thanks in advance,

Anant

---

<div class="post-metadata">

**Author:** ![ag00367508](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ag00367508](https://community.ofelia.com/u/ag00367508)\
**Post date:** [15 July 2015 07:53 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/4 "2015-07-15T07:53:08Z")

</div>

Hi Truc,

I am using 7.0.0 version.

I think the issue might be with the JSESSIONID, i read that we need to use loginservice API first before calling any other REST APIs and pass the returned JSESSIONID to futher API calls. Is my understanding correct? Or is there any other way?

But somehow even the loginservice is not working. Even though i get 200 response the message says “Unable to log in. Please check your username and password.”. Where as when i pass the same data in the browser with URL “[http://localhost:8080/bonita/loginservice?username=xxxx&password=yyyy&redirect=true](http://localhost:8080/bonita/loginservice?username=xxxx&password=yyyy&redirect=true)” it logs in.  
Tried passing the data in header as well as payload, but the result is the same. I am using Google Chrome’s Advanced Rest Client App for testing. But i would be using this finally from Talend ESB thru tRestClient connector.

Any clue on what might be the issue with loginservice?

Thanks in advance,  
Anant

---

<div class="post-metadata">

**Author:** ![ag00367508](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ag00367508](https://community.ofelia.com/u/ag00367508)\
**Post date:** [15 July 2015 09:49 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/5 "2015-07-15T09:49:26Z")

</div>

Hi Truc,

It worked for me as well now.

The issue was with the Content-Type that i was setting while making the REST calls. It works only with “application/x-www-form-urlencoded” type.

I am now able to use the JSESSIONID and make other REST API calls successfully.

Thanks a lot for your help.

Anant.

---

<div class="post-metadata">

**Author:** ![claz08](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@claz08](https://community.ofelia.com/u/claz08)\
**Post date:** [17 July 2015 19:08 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/6 "2015-07-17T19:08:48Z")

</div>

Hi, how i can implement this using PHP CURL?

---

<div class="post-metadata">

**Author:** ![weglineduardo](https://avatars.discourse-cdn.com/v4/letter/w/85f322/32.png) [@weglineduardo](https://community.ofelia.com/u/weglineduardo)\
**Post date:** [3 October 2022 20:08 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/7 "2022-10-03T20:08:24Z")

</div>

Hello.  
This link is no longer available. http://documentation.bonitasoft.com/bpm-api-1#case

I'm having trouble creating a case with the rest api.  
First I log in ok with the rest api  
and then following these examples i cant create the case

```
{  
   "processDefinitionId":"5777042023671752656",
   "variables":[  
      {  
         "name":"stringVariable",
         "value":"aValue"
      },
      {  
         "name":"dateVariable",
         "value":349246800000
      },
      {  
         "name":"numericVariable",
         "value":5
      }
   ]
}
```

I follow these suggestions and I get a 401, unauthorized. I use postman to test the rest api.

some help ?

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [15 July 2015 07:26 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/8 "2015-07-15T07:26:03Z")

</div>

Hi Anant,

Which version of Bonita BPM are you using? My comment applies to Bonita BPM 7 and I confirm there should be nothing to configure in order to enable REST APIs.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [15 July 2015 08:49 UTC](https://community.ofelia.com/t/rest-api-for-bonita-7-0-0/6134/9 "2015-07-15T08:49:01Z")

</div>

Hi,

**/loginservice** worked for me using [Chrome’s Advanced Rest Client App](https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo)

Once logged in I tested with a sample REST API call to **/API/system/session/unusedid** which was successful.

The “Unable to log in. Please check your username and password.” message lets me think there is an issue with the user’s credentials somehow. Can you double check user/password is correct?

HTH
