cancel
Showing results for 
Search instead for 
Did you mean: 

405 - method not allowed then execute a single job via REST-API

trond_nordli
Champ in-the-making
Champ in-the-making
I'm trying in the latest version 5.13 of Activiti to start a single job via REST-API but got 405 - method not allowed.

{
    "errorMessage": "Method Not Allowed",
    "statusCode": 405
}

The job exist in the database and can be access with:
GET

/service/management/jobs/13

But fails with the command that should be correct according to the user manual:
PUT

/service/management/jobs/13
Body JSON:
{
  "action" : "execute"
}

Regards

-
Trond
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
You should call a POST instead of a PUT, as you're not updating the task but rather requesting an "action" to be executed. All actions in rest (eg. task complete, signal executions, ..) are done using a POST and an action-palyload in the body.

The docs are wrong, I've corrected them on master just now. Sorry for the confusion…

trond_nordli
Champ in-the-making
Champ in-the-making
Interestingly, had tried POST but then got another error message:


{
     "errorMessage": "Unsupported Media Type",
     "status code" 415
}

But just found out that Chrome's Postman has a bug for POST where you have to manually set the content type in the header, even if you have correctly selected type raw and json.


Content-Type = application/json

Anyway thanks for the help, it worked now with POST 🙂