Salesforce Apex to Aspose WORD CLOUD API call

Hello, I’m using the below mentioned Aspose mail merge API from Apex:

Sample Request:
Endpoint: https://api.aspose.cloud/v4.0/words/Sample.docx/MailMerge?withRegions=true&fileName=SampleOutput.docx
Method: PUT
Header: Content-Type: application/json, Authorization: Bearer token
Body(JSON Data): { “data”: “some data”}

You can see that im using Bearer token for authentication to use the mail merge REST API.

Given that the Bearer token will expire after some time, i don’t want this approach in Production like environments.

So, I want to make an API call from Apex using the clientId & clientSecret.

Please let me know if there is an approach to make use of the Aspose mail merge REST API using clientId & ClientSecret.(Or if anything like no expiration Bearer token can be used).

@julianassange01

Yes, when using the Aspose hosted API via some REST client, you need to keep track of token expiry and regenerate it yourself.

However, if you do not want to use the authorization token in your request at all, then you can use the self-hosting solution. You can omit the User and Password parameters while initiating the Aspose.Words Cloud Docker container.

1 Like

@tilal.ahmad
Ok, i guess the only option for me is to regenerate the token every time via a separate API call , before the mail merge API call to Aspose Cloud from Apex.
Thank You

1 Like

@julianassange01

Ok, please feel free to contact us for any further assistance in this regard.

1 Like