REST Call Put method with request mapping

cancel
Showing results for 
Search instead for 
Did you mean: 
Established Member

REST Call Put method with request mapping

Jump to solution

Hello everyone,

I want to update several variables existing in an array with REST Call

endpoint : api/runtime/process-instances/${id}/variables

Method : PUT

But in Activiti only we are allowed to update one variable because of the request mapping

I am using Alfresco Activiti

Please any help is appreciated

Kind regards.

1 Solution

Accepted Solutions
Senior Member II

Re: REST Call Put method with request mapping

Jump to solution

Btw, you can now do request body JSON mapping in the newer version of the product which was released last week. See REST call | Alfresco Documentation  for more details.

However as Greg said, a script/service task would be more appropriate in this particular use case.

View solution in original post

9 Replies
Intermediate

Re: REST Call Put method with request mapping

Jump to solution

not sure i understand your problem.

The API you cite allows you to update as many variables as you wish within the instance.

[
  {
    "name":"intProcVar"
    "type":"integer"
    "value":123
  },
  {
    "name":"anotherProcVar"
    "type":"string"
    "value":"myStrong"
  }
]

Cheers,

Greg

Established Member

Re: REST Call Put method with request mapping

Jump to solution

but I am using Alfreco Activiti environment , so how can I map this request as json body into the request mapping ?

Intermediate

Re: REST Call Put method with request mapping

Jump to solution

So you want to update a process variable in the current process instance and you want to use the REST connector?

Honestly, this is just dumb.

Use a script task/listener with the execution setVariable() call.

If you are afraid of scripting and Java, then Activiti is not the environment for you,

Greg

Established Member

Re: REST Call Put method with request mapping

Jump to solution

Your reply is kind of rude.

I just want to update variables of parent process with rest inside a call activity and not in same process, if you don't have an answer you can just not reply.thank you Smiley Happy

Intermediate

Re: REST Call Put method with request mapping

Jump to solution

Just trying to save you a lot of pain.

You cannot build a non trivial Activiti process solution without using Java and scripts, it was one of the basic premises of the platform from inception to take BPM to developers.

Apologies if you found my answer rude.

Greg

Established Member

Re: REST Call Put method with request mapping

Jump to solution

Apology accepted, thank you for your advice I will take it in consideration.

Senior Member II

Re: REST Call Put method with request mapping

Jump to solution

Hi Ben,

If you are trying to update/add a variable to a parent process from child via a groovy script, the following will do

runtimeService.setVariable( execution.getSuperExecutionId(), 'varname', 'varvalue');

-Ciju

Established Member

Re: REST Call Put method with request mapping

Jump to solution

Hi Joseph 

Thank you , this works like a charm

Senior Member II

Re: REST Call Put method with request mapping

Jump to solution

Btw, you can now do request body JSON mapping in the newer version of the product which was released last week. See REST call | Alfresco Documentation  for more details.

However as Greg said, a script/service task would be more appropriate in this particular use case.

View solution in original post