rpula123

Unable to retrieve package information

0 votes
Hi , I am trying to call the RETRIEVE INFORMATION ABOUT A PACKAGE api and getting the below error. Can you please let me know why i am seeing this error. I have pasted my code below. GET request for "https://sandbox.e-signlive.com/api/packages/hT6KgjULdVx6sJsGN20GVqrWCFw=" resulted in 404 (Not Found); invoking error handler Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:588) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:546) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:510) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:453) at com.unionbank.soa.api.esign.service.OneSpanServices.main(OneSpanServices.java:35) Code: public static void main(String args[]){ String url = "https://sandbox.e-signlive.com/api/packages/{packageId}"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); String encodedAuth = "*****"; // i am passing the api key here String authHeader = IWebserviceConstants.BASIC + encodedAuth; headers.set(IWebserviceConstants.AUTHORIZATION , authHeader); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity entity = new HttpEntity("parameters", headers); Map params = new HashMap(); params.put("packageId", "hT6KgjULdVx6sJsGN20GVqrWCFw="); ResponseEntity result = restTemplate.exchange(url, HttpMethod.GET, entity, Package.class,params); System.out.println(result); }

Reply to: Unable to retrieve package information

0 votes
Hi there, First, you could do an extra error handling for your Spring RestTemplate something like below:
		try {
			ResponseEntity result = restTemplate.exchange(url, HttpMethod.GET, entity, Package.class, params);
			System.out.println(result);
		} catch (HttpStatusCodeException exception) {
			int statusCode = exception.getStatusCode().value();
			String errorMessage = exception.getResponseBodyAsString();
			System.out.println(statusCode + " : " + errorMessage);
		}
Which would receive the error stream from OneSpan Sign which contains the exact error message. Then from your 404 error, could it because there's a mismatch between your endpoint url (https://sandbox.e-signlive.com), your package id (hT6KgjULdVx6sJsGN20GVqrWCFw=) and your api key? Please let me know once you got the error message. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to retrieve package information

0 votes
Thanks Duo for the reply. I have made the changes and below is the error message. The API key i am passing is the one which is assigned to our bank which i believe is encrypted. 404 : {"technical":"Could not find user with uid 'BGVhg2EB9lQT'","messageKey":"error.notFound.userNotFound","message":"The specified user cannot be found.","code":404,"name":"Resource Not Found"} This is how i am sending key in the header. Could you please share a sample code on how to pass the api key in the header. String encodedAuth = “*****”; // for security reason i am not mentioning the actual api key while posting it in the forum. String authHeader = IWebserviceConstants.BASIC + encodedAuth; headers.set(IWebserviceConstants.AUTHORIZATION , authHeader); Thanks Rajesh

Reply to: Unable to retrieve package information

0 votes
Hi Rajesh, If you received this error message, it means your API key has been successfully added to the header. (otherwise, it would be a 401 Unauthorized error) And it seems that your account can't be found in https://sandbox.e-signlive.com. Could we make sure that the API_URL(sandbox.esignlive.com vs sandbox.e-signlive.com), API_KEY and package Id are all consistent? Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to retrieve package information

0 votes
Hi Duo, it worked after updating url to sandbox.esignlive.com . In the API documentation it was given as sandbox.e-signlive.com. So i was using that. Thanks Duo for your help. RETRIEVE INFORMATION ABOUT A PACKAGE GET /packages/{packageId} Description Retrieve information about a single document package. Example Request GET https://sandbox.e-signlive.com/api/packages/84174f44-74f0-4e35-af45-6f1792df5972

Reply to: Unable to retrieve package information

0 votes
Glad that you figured it out! Let us know if you have any other issues! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


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