Here is my POST request.
curl -v -k -H "Content-Type:application/json" -b /tmp/zen.cookies -X POST https://${WEB_URL}/zen-data/v2/serviceInstance -d
{"serviceInstanceNamespace":"${namespace}","serviceInstanceVersion":"1.3.5","createArguments":{"parameters":{"global.icp4Data":"true","global.pvc.pvProvisioning":"NamedStorageClass","global.filebeat.output.logstashEnabled":"false","global.filebeat.output.consoleEnabled":"true","metadata.storageClass":\\"${storageclass}\\","imagePullSecrets":"ownerServiceInstanceUsername":""},"transientFields":{}}
It gives me this error:
{"code":400,"message":"parsing body body from \"\" failed, because invalid character 's' looking for beginning of value"}* Could not resolve host: serviceInstanceDisplayName; Unknown error
12:24:32 * Closing connection 1
12:24:32 curl: (6) Could not resolve host: serviceInstanceDisplayName; Unknown error
12:24:33 * Could not resolve host: serviceInstanceNamespace; Unknown error
To substitute a variable inside JSON in POST command, you need to do this:
"'"${variableName}"'"
A double quote inside a single quote which is inside a double quote. So it looks like this:
curl -X POST www.example.com -d '{"country": "city","province":"'"${variableName}"'"}'