I'm sure that this is a basic syntax question, but I am trying to hit an API that wants "a request" structured like:
{"customer":{"firstName":"Regular","lastName":"Joe"}...}
I also want to include some options, including query parameters, i.e.:
options = {
method: "POST"
url: "https://api.rezdy.com/latest/bookings"
qs: {
apiKey: apiKey,
}
json: true
}
How do I include the former data in the options
hash so that I can call it like so?
request(options, (err, response, body)->
...
)
I tried doing it with formData
like so:
options = {
method: "POST"
url: "https://api.rezdy.com/latest/bookings"
qs: {
apiKey: apiKey,
}
formData: data
json: true
}
but I am still getting errors back from the API suggesting that it has not received data. What is the correct way to include the data in the options hash?