wenlvdlcn-ibm-com | Posts: 2

missing package details when search package.

0 votes
Hi there, I just start to use this function in our platform, and when I try to fetch all packages' info, I notice the response only contains 1 package details even the "count" value is 2. Could you pls help to check? Thanks a lot in advance. Code segment: http.url = 'https://sandbox.e-signlive.ca/api/packages'; http.followRedirects = true; http.httpMethod = 'get'; ..... var response = http.retrieveWithoutException(); var pluto = response.getBodyAsText(); ret = 'Code:' + response.getStatusCode(); ret += '
pkgID:' + JSON.parse(pluto) ['id']; return ret. Result: pls refer the attachment

Attachments
M7.png14.39 KB
wenlvdlcn-ibm-com | Posts: 2

Reply to: missing package details when search package.

0 votes
Hi Haris, Thanks for your reply, I review the post you mentioned and it works now. Besides, when I move forward, encounter another issue with upload document to package, could you pls help to check? Thanks in advance. code segment: usingLibrary('WseExternal'); var http = new HttpConnection(); var ret = ''; http.url = 'https://sandbox.e-signlive.ca/api/packages/19c4b6e4-3290-4fab-a938-0b88fd8edc7e/documents'; http.followRedirects = true; http.httpMethod = 'POST'; // http body http.postBody = "hello world!!"; // http headers var myheaders = []; myheaders['Authorization'] = 'Basic ===='; myheaders['Content-type'] = ["text/plain"]; myheaders['Content-Disposition'] = ['form-data, name="files[]",filename="test01.txt"']; http.headers = myheaders; http.timeout = 0; try { var response = http.retrieveWithoutException(); var pluto = response.getBodyAsText(); ret = 'Code:' + response.getStatusCode(); ret += "
body: " + pluto; return ret; }catch(e){ return e; } Result: Got response code 500. Pls refer the attachment.

Attachments
M5.png19.61 KB
harishaidary | Posts: 1812

Reply to: missing package details when search package.

0 votes
Hey there, What technology is the code above? Basically, here's what you HTTP request should look like when uploading a PDF document to a package:
POST /api/packages/19c4b6e4-3290-4fab-a938-0b88fd8edc7e/documents HTTP/1.1
Host: sanbox.e-signlive.ca
Connection: keep-alive
Content-Length: 80357
Accept: text/html
Cache-Control: no-cache
Authorization: Basic api_key
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarycywBKPMXcPHApu4C

------WebKitFormBoundarycywBKPMXcPHApu4C
Content-Disposition: form-data; name="file"; filename="doc1.pdf"
Content-Type: application/pdf

%PDF-1.5
%µµµµ
1 0 obj
>>>
endobj....

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="payload"

{"name" : "document1"}
------WebKitFormBoundary7MA4YWxkTrZu0gW--

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