createsend-node icon indicating copy to clipboard operation
createsend-node copied to clipboard

how to access full details about response

Open srkimir opened this issue 10 years ago • 0 comments

What seems to me from following example, is that library will return just body of response for err or data, what about headers? What if i need status code of response?

...transactional.sendSmartEmail({
  To: [...],
  Data: {...},
  smartEmailID: ...,
  clientID: ...
}, function (err, data) {
  if (err) {
    console.log('ERROR', err)
  } else {
    console.log('RESPONSE', response)
  }
})

For example if recipient is omitted, err would be:

{ 
  Code: 952,
  Message: 'Recipient is required. At least one To, CC, or a BCC address is required' 
}

srkimir avatar Feb 20 '16 18:02 srkimir