Failed to execute action through API

I am running an action through API as below -

curl --insecure -X POST -H ‘Connection: keep-alive’ -H ‘Accept-Encoding: gzip, deflate’ -H ‘Accept: /’ -H ‘User-Agent: python-requests/2.14.2’ -H ‘content-type: application/json’ -H 'X-Auth-Token: ’ -H ‘Content-Length: 73’ --data-binary ‘{“action”: “core.local”, “user”: null, “parameters”: {“cmd”: “sudo systemctl stop ntpd”}}’ https:///api/v1/executions

Its failing with error

"faultstring": "Failed to parse request body: Unterminated string starting at: line 1 column 62 (char 61)"

If I run same API with commands like “ifconfig” it works, please let me know what wrong I am doing.

Please do needful.

Hard to say for certain, since you’ve masked out some details above. But most likely it’s just what the error is telling you - you have an unterminated string, usually due to misplaced or missing ' or ".

Try running your command from CLI with --debug, e.g. st2 --debug run core.local ...

That will display the equivalent curl calls. Compare those with what you’re using.