REST API calls with HTTP basic Authentication
I'm trying to write a script to init a Bonita server automatically. The aim of this script is to :
- import my organization
- import my bdm
- import processes
- import an application and related pages
First of all, i'd like to create a user with the 'install' technical user. To do this, I'm doing an HTTP Post request on http://localhost:8080/bonita/API/identity/user/. I set Content-Type to application/json, set Authorization to use the 'install' user and pass the following body :
When I make this HTTP request from REST Client, it works. When I make this HTTP request from my nodeJS script, I get a 401 HTTP status (this script uses request module). I've also tried to make my request with curl but got the same result (401).
In my script, I've also tried to make a call to loginservice to get the Bonita cookie and pass this cookie to my POST request but it does'nt work either.
I'm using Bonita 7.2.2.
Is it possible to make a call to Bonita REST API using basic HTTP authentication ?
Do you a way to do what I want to do ? Perhaps, you have an example...
Thanks in advance for your help.
I like the idea of doing it this way, but like you found various problems. In the end we used a third party automation tool to do this for us.
Extract the zip
Start the server
do the actual "clicks" to upload the organization etc.
close server and restart
PS: If this reply answers your question, please mark as resolved.
I finally get it to work. In nodejs request module, there is a "jar" parameter" to keep cookies between two requests. With this parameter to true in my 2 requests (login, create user), it works.
However, it doesn't explain why it does'nt work with a Basic HTTP authentication.
Would you be interested in sharing your project, did you put it on github or somewhere?