Process-definition put suspend api not working

process-definition put suspend api not working:

localhost:4200/engine-rest/process-definition/suspended
{
    "processDefinitionKey":"Process_1jq3et1",
    "suspended": true,
    "includeProcessInstances" : true,
    "executionDate" : "2013-11-21T10:49:45"
}
localhost:4200/engine-rest/process-definition/Process_1jq3et1:4:ad834e02-c10a-11ec-9bf4-caff283c2eeb/suspended
{
    "suspended": true,
    "includeProcessInstances" : true,
    "executionDate" : "2013-11-21T10:49:45"
}

  • response of all is: 204, but do not affect.
    (process-definition suspend, just work by camunda app cockpit)

Hi @iamliji

Can you explain exactly what you would expect to see happen and what you’re seeing happening?

Hi @Niall and thanks.
After suspend by camunda app cockpit, ‘Get process-definition’ is like this:

id: "invoice:1:355b7099-b424-11ec-af2f-caff283c2eeb"
key: "invoice"
name: "Invoice Receipt"
resource: "invoice.v1.bpmn"
startableInTasklist: true
suspended: true //<======= ok. work!

but with ‘process-definition put suspend api’, response status is 204 and ‘Get process-definition’ is like this:
(if execute previous APIs by this id & key)

id: "invoice:1:355b7099-b424-11ec-af2f-caff283c2eeb"
key: "invoice"
name: "Invoice Receipt"
resource: "invoice.v1.bpmn"
startableInTasklist: true
suspended: false //<======= not ok. do not affect!

(other api like ‘suspend process instance’, working well at the same time.)

I have just tested this with:

curl -X PUT "http://localhost:8080/engine-rest/process-instance/{id}/suspended" -H  "accept: */*" -H  "Content-Type: application/json" -d "{\"suspended\":true}"

And it works as expected. Sending {\"suspended\":false} un-suspends the process.

dg

any way, thanks @davidgs
despite many attempts, it is not working for me.

So make sure that you are starting your Camunda instance with the REST API’s enabled, and also start it with the SwaggerUI enabled.

With the swaggerUI enabled, you can go to http://localhost:8080/swaggerui and get direct access to the REST APIs for testing. See if you can get the commands to work via that method. If they are returning any errors, etc, please post them here so we can help you track them down.

Best Regards,
dg

From the link you posted, the 204 is expected.

Do you include any JSON in the body of the PUT to localhost:4200/engine-rest/process-definition/ad834e02-c10a-11ec-9bf4-caff283c2eeb/suspended

ok, this work if change ‘process-instance/{id}’ to ‘process-definition/{id}’

but if add “executionDate” in body (according to documentation), it is not working.

Those two APIs do different things. The one that I sent suspends a specific process instance whereas the one you’re using suspends an entire process. Those two things are not the same. An instance is a particular running job process. Suspending the entire process means that you won’t be able to start new instances of the process until you un-suspend the process.

So I think it’s important to decide which you are actually trying to accomplish, and then use the appropriate API.

Hope that all makes sense!
dg

According to this documentation:

we have:


Request

PUT /process-definition/suspended

{
  "processDefinitionKey" : "aProcessDefinitionKey",
  "suspended" : true,
  "includeProcessInstances" : true,
  "executionDate" : "2013-11-21T10:49:45"
}

Response

Status 204. No content.


But as i test it by Postman, this working if and only if we remove executionDate in body.
And your reply(solution) worked, because the curl haven’t executionDate in body.