Cannot complete task.. is not from type 'Collection' REST

Hey there,

i want to complete a task and send a Array via REST API to the Engine.

I try :

 {
"Variables":
    "verifierList":{"Value":["mp","gk"], "Type": "Object",
    "valueInfo": {"serializationDataFormat":"application/x-java-serialized-object",
    "objectTypeName": "java.util.ArrayList"  }
 }

but still get the response:

“Cannot complete task 0c360ded-9981-11e8-b70a-005056980f4d: ENGINE-02025 Variable ‘verifierList’ is not from type ‘Collection’.”

Can someone tell me what I’m doing wrong?

Hello Martin,

I copied your json into an online json parser and apparently you had a syntax error.
Try if it works with the following json:

{
	"Variables": {
		"verifierList": {
			"Value": ["mp", "gk"],
			"Type": "Object",
			"valueInfo": {
				"serializationDataFormat": "application/x-java-serialized-object",
				"objectTypeName": "java.util.ArrayList"
			}
		}
	}
}

I hope this helps.

Regards,
Christian.

Hello @Christian_Tobler Thanks, but it was a copy error and it does not fix my problem, still the same exception.

Hello I am also trying to do this. Is this the best way or is using Spin better. I want to write a generic class to send variables to a Task. I am trying to understand how to do that with with a generic JSON string and then use Spin on the Camunda side.

@Zyk88 Were you able to get this working?

Hello, right now we don’t support it.

OK turns out it is easy. It just needs:

type: 'Json' 

But it says

Variable is not from type ‘Collection’

So I tried serializing as ArrayList with

type: 'Object',
            valueInfo: { "serializationDataFormat": "application/json",
              "objectTypeName": "java.util.ArrayList" } }

OK if it is JSON you have to use

${collectionVariable.elements()}
1 Like