Reputation: 84
I'm trying to automate talend job executions using the Talend API but I'm getting an error when I try to pass the context params using the api.
The json I'm encoding to 64 is the following:
JSON='{ "actionName":"runTask", "authPass": "TalendPass", "authUser": "[email protected]", "jvmParams": [ "-Xmx256m" , "-Xms64m" ], "contextParams": ["host_mysql_db01": "failed", "database_analytics": "testing.it"],"mode": "synchronous", "taskId": 43}'
Error message:
{"error":"Expected a ',' or ']' at character 172","returnCode":2}
I found another stackoverflow issue Add context parameters to Talend job in Tac via API without actually running it but he doesn't say how he pass it and I cannot reply with a comment asking how he did it
The real talend api call is:
wget -O file http://localhost:8080/org.talend.administrator/metaServlet?$JSON_ENCODED
Can I get some help?
Upvotes: 0
Views: 871
Reputation: 4051
Actually, the json your are passing to the metaservlet is not valid json. You can check it with an online validator like http://jsonlint.com.
You are specifying the contextParams
attribute as an array, but that syntax is not valid in json. An array can contain either a list of values (like jvmParams
) or objects (which can themselves contain arrays). Here's an example.
Moreover, according to Talend reference, the attribute should be called "context
" and must be an object instead of an array, like so:
"context":{"varname1": "varvalue", "varname2": "varvalue2"}
Upvotes: 2