You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Correct syntax for using variables in API POST request

Accepted answer
13
Views
2
Comments
edited Mar 4, 2019 12:30PM in Integrations and APIs 2 comments

Summary

I can make a successful API POST request using actual data which I now want to swap out for variables

Content

I can successfully POST data values into Oracle Service Cloud but need the correct syntax to replace the values with variables.
 
var settings = {
  "async": true,
  "crossDomain": true,
  "method": "POST",
  "headers": {
    "authorization": "somesecretstring",
    "content-type": "application/json",
  },
  "processData": false,
"data": "{\"keyfield\":999999,\"foreignkeyfield\":{\"id\":888888},\"anytextfield\":"Some text data",\"date\":${date},.......
 
I want to replace most of my field values with variables and have tried above to substitute the date value with ${datevariablename} previously declared, as I thought that syntax might work. I get Bad JSON (what a message!) implying the syntax is incorrect.

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!