Split PDF From SFDC Apex - UnsupportedApiVersion 1.1 Error

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’; ](http://api.aspose.com/v1.1%E2%80%99;)

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’](http://api.aspose.com/v1.1/pdf/00P0n000002bzPJ/split?from=1&to=2&appSID=631ad442-3085-44b5-a665-0e1ca86423ed&signature=yF%2FS7rZMVOatx7AwhZORl6Z5Rf0%E2%80%99) does not support the API version ‘1.1’.”}}

@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.

1 Like

Thanks for the quick reply. Before I head down the OAuth 2.0 route, I am using the existing Aspose for SalesForce framework: GitHub - asposemarketplace/Aspose_for_SalesForce: This project holds Aspose for Cloud SDK/examples for Apex/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?

@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.

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.

@intelepeer

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

@intelepeer

Please note since Aspose.Words Cloud 19.4 release we have made some breaking changes. We have introduced Json Web Token(JWT) authentication method, Storage API methods and changed POST methods to PUT and vice versa. Please check the blog for more details. Please feel free to ask any questions or concerns in this regard.