Vinay | Posts: 4

Upload documents with post request

0 votes
Hi! I am not able to create new documents using post method from NodeJs server, please find the request and response below
  domain: null,
  _events: { end: [Function: bound _clearTimeout] },
  _eventsCount: 1,
  _maxListeners: undefined,
  _agent: false,
  _formData:
   FormData {
     _overheadLength: 163,
     _valueLength: 0,
     _lengthRetrievers: [ [Function] ],
     writable: false,
     readable: true,
     dataSize: 0,
     maxDataSize: 2097152,
     pauseStreams: true,
     _released: false,
     _streams:
      [ '----------------------------703401962293487607875932\r\nContent-Disposition: form-data; name="files[]"; filename="Objective.pdf"\r\nContent-Type: application/pdf\r\n\r\n',
        [Object],
        [Function: bound ] ],
     _currentStream: null,
     _events: { error: [Function: bound ] },
     _eventsCount: 1,
     _boundary: '--------------------------703401962293487607875932' },
  method: 'POST',
  url: 'https://sandbox.e-signlive.com/api/packages/7d6ed628-1d3f-4110-8b2b-87645da3cb04/documents',
  _header:
   { 'user-agent': 'node-superagent/1.8.3',
     accept: 'application/json',
     'content-type': 'multipart/form-data',
     authorization: 'Basic #####################' }, //my api key
  header:
   { 'User-Agent': 'node-superagent/1.8.3',
     Accept: 'application/json',
     'Content-Type': 'multipart/form-data',
     Authorization: 'Basic ######################' }, //my api key
  writable: true,
  _redirects: 0,
  _maxRedirects: 5,
  cookies: '',
  qs: {},
  qsRaw: [],
  _redirectList: [],
  _streamRequest: false
response
{ [Error: cannot POST /api/packages/7d6ed628-1d3f-4110-8b2b-87645da3cb04/documents (406)]
  status: 406,
  text: '{"dirtyFields":["messageKey","code","technical","name","message"],"packageId":null,"technical":"","messageKey":"http.status.406","entity":null,"message":"[http.status.406]","code":406,"name":"Unhandled Server Error"}',
  method: 'POST',
  path: '/api/packages/7d6ed628-1d3f-4110-8b2b-87645da3cb04/documents' }
Thanks, Vinay

Approved Answer
harishaidary | Posts: 1812

Reply to: Upload documents with post request

0 votes
Hi Vinay, Can try changing your accept header to "text/html" and see if that works?

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off