Split PDF From SFDC Apex - UnsupportedApiVersion 1.1 Error


#1

Hello,
I have successfully uploaded a file from Salesforce to Aspose Cloud, and am now trying to split the document. When I try to run a /split via REST API I receive an UnsupportedApiVersion 1.1 Error:

Apex Code:
public static String url = ‘http://api.aspose.com/v1.1’;

AsposeCloudApp.setAppInfo(appKey, appSID);

String strURI = url + ‘/pdf/’ + Filename + ‘/split’;
strURI += ‘?from=’ + startPage + ‘&to=’ + endPage;

String signedURI = AsposeUtils.Sign(strURI);

String strJSON = AsposeUtils.ProcessCommand(signedURI, ‘PUT’, ‘’, ‘json’);

Request:
14:07:36:063 CALLOUT_REQUEST [234]|System.HttpRequest[Endpoint=http://api.aspose.com/v1.1/pdf/00P0n000002bzPJ/split?from=1&to=2&appSID=631ad442-3085-44b5-a665-0e1ca86423ed&signature=yF%2FS7rZMVOatx7AwhZORl6Z5Rf0, Method=PUT]

Response:
14:07:36:252 CALLOUT_RESPONSE [234]|System.HttpResponse[Status=Bad Request, StatusCode=400]

JSONResponse:
14:07:36:252 USER_DEBUG [5]|DEBUG|{“Error”:{“Code”:“UnsupportedApiVersion”,“Message”:“The HTTP resource that matches the request URI ‘http://api.aspose.com/v1.1/pdf/00P0n000002bzPJ/split?from=1&to=2&appSID=631ad442-3085-44b5-a665-0e1ca86423ed&signature=yF%2FS7rZMVOatx7AwhZORl6Z5Rf0’ does not support the API version ‘1.1’.”}}


#2

@intelepeer

Thank you for contacting Aspose Support.

You are using invalid base URL. Correct base URL is https://api.aspose.cloud/v1.1

I have written the following Postman example to explain the complete API flow:

  1. First API is making OAuth request and getting Access Token
  2. Second API is uploading “sample-input.pdf” file to Aspose Cloud
  3. Third API is splitting PDF

Please feel free to contact us if you need any further information.

P.S. We would recommend you use OAuth 2.0 authentication instead of URL Signing as it is more convenient to use. Please check this article for more details.


#3

Thanks for the quick reply. Before I head down the OAuth 2.0 route, I am using the existing Aspose for SalesForce framework: https://github.com/asposemarketplace/Aspose_for_SalesForce. I have updated the base URL to the above and receive the same UnsupportedApiVersion 1.1 response. It is using URL signing. Is this not supported? Do I need to completely switch over to using the sample you provided?


#4

@intelepeer

We are supporting URL Signing and keep doing that. OAuth 2.0 is an alternative and it is user’s choice to use it or not.

We are going through the Aspose for SalesForce project and checking why it is giving UnsupportedApiVersion 1.1 error. We will let you know as soon as the issue is fixed.


#5

This has been resolved :slight_smile: I switched to OAuth 2.0 authentication, and in doing so realized I was using a PUT rather than a POST for the /split command.


#6

@intelepeer

It’s good to know your issue has been fixed. Please keep using our Cloud APIs. Thanks.