kpower | Posts: 3

Trying to archive

0 votes
I've grabbed a completion report and am looping through the packages to archive them. I've tried the following: RestClient client; client = new RestClient("https://apps.e-signlive.com/api"); UrlTemplate template; template = new UrlTemplate("https://apps.e-signlive.com/api"); String path = template.urlFor(UrlTemplate.PACKAGE_ID_PATH) .replace("{packageId}", packageCompletionReport.getId()) .build(); String json = "{\"status\":\"ARCHIVED\"}"; try { client.put(path, json); } catch (RequestException e) { throw new EslServerException("Unable to archive the package.", e); } catch (Exception e) { e.printStackTrace(); throw new EslException("Unable to archive the package. Exception: " + e.getMessage()); } but I get an unauthorized error. Do I need to set header for Authorization? If so how do I do it? Thanks in advance for assistance

Approved Answer
mwilliams | Posts: 957

Reply to: Trying to archive

0 votes
You posted in the Java SDK forum vs the REST API forum. Does this mean you're okay with using the Java SDK or are you really wanting to use the REST API? Here's a simple example of the code necessary to use the Java SDK to archive a package:
EslClient eslClient = new EslClient( API_KEY, API_URL );
PackageId myPackage = new PackageId("YOUR_PACKAGE_ID_STRING");
eslClient.getPackageService().archive(myPackage);
Hope this helps. Let me know if you for sure want REST and I will look at getting you the exact call to make.

kpower | Posts: 3

Reply to: Trying to archive

0 votes
Michael, Thanks for your response. I was initially trying to do it with the EslClient but it wasn't working for me using SDK 10.6 and when I contacted support they asked me to use the REST method above. I updated my sdk to 10.10 and used your code with success. Sorry I missed seeing the REST forum, just saw the first thing I wanted to see:) Thanks again, Kevin

mwilliams | Posts: 957

Reply to: Trying to archive

0 votes
Haha. Not a problem. Just wanted to get the answer you REALLY wanted to you. If you'd like me to look into the REST method, I will gladly do so. :)

kpower | Posts: 3

Reply to: Trying to archive

0 votes
Not necessary Michael, but thanks for the offer. Kevin

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