cancel
Showing results for 
Search instead for 
Did you mean: 

rest api starting a process ,getting back 400

rascaly2k
Champ in-the-making
Champ in-the-making
Hi I am trying to start a process , with the key name approvalProcess

I am using Adavance rest client chrome to test the service

To see if its deployed and available

I use

method : get
http://localhost:8081/activiti-rest/service/repository/process-definitions?key=approvalProcess

output: Status 200 OK
{
data: [1]
0:  {
id: "approvalProcess:1:11580"
url: "http://localhost:8081/activiti-rest/service/repository/process-definitions/approvalProcess:1:11580"
key: "approvalProcess"
version: 1
name: "Page Approval Process"
description: null
deploymentId: "11577"
deploymentUrl: "http://localhost:8081/activiti-rest/service/repository/deployments/11577"
resource: "http://localhost:8081/activiti-rest/service/repository/deployments/11577/resources/Page Approval Process.bpmn20.xml"
diagramResource: "http://localhost:8081/activiti-rest/service/repository/deployments/11577/resources/Page Approval Process.approvalProcess.png"
category: "http://activiti.org/bpmn20"
graphicalNotationDefined: false
suspended: false
startFormDefined: false
}-
-
total: 1
start: 0
sort: "name"
order: "asc"
size: 1
}


So I know its deployed , but when I try to start with with parameters its gives a bad requests and i don't know what to do . People else where suggested that the contype might not be set , I did that . But no cigar . Would some kind soul shed some light


method: post
url:http://localhost:8081/activiti-rest/service/runtime/process-instances

header
Authorization:Basic a2VybWl0Omtlcm1pdA==
Accept:application/json
Content-Type:application/json

body
{
   "processDefinitionKey":"approvalProcess",
   "variables": [
      {
       "type":"page",
       "typeId":"123"
      }
   ]}

Status
400 Bad Request


Any suggestions , would greatly be appreciated
Thankx in advance
-
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
the type 'page' is something Activiti does not know.

Did you try it without the variables property?

mignet
Champ in-the-making
Champ in-the-making
I have also met this issue in Activiti 5.17.0,I follow the user guide and test Rest API "15.5.4. Start a process instance" with RestClient.post body like this:
<code>
{
   "processDefinitionId":"oneTaskProcess:1:158",
   "businessKey":"myBusinessKey",
   "variables": [
      {
        "name":"myVar",
        "value":"This is a variable",
      }
   ]
}
</code>
response result:<code>

HTTP Status 400 -

type Status report

message

description The request sent by the client was syntactically incorrect.
Apache Tomcat/7.0.57
</code>
when I remove variables and test again,
<code>
{
   "processDefinitionId":"oneTaskProcess:1:158",
   "businessKey":"myBusinessKey"
}
</code>
I got a 500 error like this:
<code>
HTTP Status 500 - Request processing failed; nested exception is org.activiti.engine.ActivitiException: Unknown property used in expression: ${person.id}
</code>
now,I found that starting a process without process variables is ok,but the process with variables can't.Why?

mignet
Champ in-the-making
Champ in-the-making
Solved!the variables have a special format with a name/value pair.
here is my post body:
<code>
{
    "processDefinitionId": "vacationRequest:1:33",
    "variables": [
        {
            "name": "employeeName",
            "value": "Miss Piggy"
        },
        {
            "name": "numberOfDays",
            "value": "10"
        },
        {
            "name": "startDate",
            "value": "2011-01-11"
        },
        {
            "name": "returnDate",
            "value": "2011-01-11"
        },
        {
            "name": "vacationMotivation",
            "value": "tired"
        }
    ]
}
</code>
Everything is All Right!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.