-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The --data flag does not accept a valid json array. So it seems that somewhere along the lines the --data assumes it is only accepting either shorthand syntax (e.g. item.value=1) or a json object.
c8y api post /example --data '[{"fragment": "myTemp","series": "myT" }, {"fragment": "myWind","series": "mySpeed"} ]' --dryOutput
c8y api post /example --data '[{"fragment": "myTemp","series": "myT" }, {"fragment": "myWind","series": "mySpeed"} ]' --dry
2025-02-13T08:39:28.436+0100 ERROR commandError: json error: data parameter does not contain valid json or shorthand json. Invalid shorthand JSON: Uneven number of key value pairs
Workaround
Use the --template flag instead as it accepts all valid json (as the templating language, jsonnet, is a superset of json, so it accepts both json and jsonnet syntax).
c8y api post /example --template '{"v":[{"fragment": "myTemp","series": "myT" }, {"fragment": "myWind","series": "mySpeed"} ]}' --dryReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels