How to instantiate a new process via REST API

Hi all,

I’ve donwloaded REST API from here. This API works fine with GET method to know for example how process are opened, how many users have tasks running etc…
I’ve started my Tomcat bundle, loaded bar application and organisation and I can to start a process form portal easily.
Now, I would to start a process from REST API and documentation shows this method :

public int startACase(long processDefinitionId) This method needs a long id, this id is returned by an another method : private long deployProcess()

who calls this method :

private long installProcessFromUploadedBar(String uploadedFilePath)

who calls this method :

private long extractProcessId(HttpResponse response)

But in my case, I don’t need to to call all these methods because bar file is loaded in Tomcat bundle yet.
I’m just need to start a case, if I must to call startAcase(long id) then how to generate an uniq long id ?
And if I can to instantiate a process by an other way, please could you tell me how to do it ?

Thanks in advance, it’s very important for me to find a solution.
Sorry for my bad english ;

Thanks you very much Sean !

with this GET method, i get all my processes who are running :

http://localhost:8090/bonita/API/bpm/process?p=0&c=10

this GET method returns a JSON, then in my Java code, I’ve just to get the id process like that :

strJson = app.getStrJson(); JSONArray jsa = new JSONArray(strJson);
	for(int i = 0; i < jsa.length(); i++)
	{
		JSONObject jso = jsa.getJSONObject(i);
		System.out.println(jso.getString("id"));
	}

after parse long value, I’ve now just to call startAcase(long processId) and it works fine.

Thank you Sean !

Good question,

I think the way to do it is SEARCH process/get…

Search for a process

Search for processes that match the search criteria.

Request url http://…/API/bpm/process?parameters
Request method
GET
Request payload
empty
Response payload
Matching processes in JSON
Parameters

Standard search parameters p and c must be specified
s: search on “name”, “displayName” or “version”
o: can order by “name”, “version”, “deploymentDate”, “deployedBy”, “activationState”, “configurationState”, “processId”, “displayName”, “lastUpdateDate”, “categoryId”, “label”
f: can filter on “name”, “version”, “deploymentDate”, “deployedBy”, “activationState” with the value DISABLED or ENABLED, “configurationState” with the value UNRESOLVED, or RESOLVED, “processId”, “displayName”, “lastUpdateDate”, “categoryId”, “label”, “supervisor_id”
d: can deploy on “deployedBy”

found here

Hello Sean,

Ok I see. I’m going to try by this way.
Thank you Sean for your response.

I’ll be back to give a feedback

Good idea Sean !

It’s very interesting, for example I can to see my all processes deployed by this GET method :

http://localhost:8090/bonita/API/bpm/process?p=0&c=10

Now, I would to set a filter to see only processId in HTTP request, then I’ve tried this but not working :

http://localhost:8090/bonita/API/bpm/process?p=0&c=10&f=processId

Sean, do you know how to set correctly a filter in a HTTP request please ?

Thanks in advance.