Generate signature to use in curl


#1

how do i generate the signature in order to use the curl requests


#2

@mufeel

Thank you for contacting Aspose Support.

We would recommend you use OAuth 2.0 protocol instead of URL Signing for APIs authentication. Following is a cURL example to get Access Token:

// cURL Example to get Access Token
// Get your App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/oauth2/token" \
-X POST \
-d 'grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Then use received access_token to call any Aspose Cloud API:

// cURL example to upload file to Aspose Cloud Storage
curl -v "https://api.aspose.cloud/v1.1/storage/file?path=testfile.txt" \
-X PUT \
-T testfile.txt \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-H "Authorization: Bearer qyc9asneEZsTZtRro3Qd2ZH38jQdBLabtIi5nE3DPgdbGolk0K8RQwB1kC1umqfp4rAKeP8gFTIRSRhl6uShnbX70X-_ieDHPAK1cCAH1Kiq6fz8lnHZc-zXmHir_TxsXrjvsjMGDwRmhjncUDMPhEU4Ah8rq0XT-8Q_dz2lWCnJsrYMXp8S2jf0QRb3xmIT5Bw1lRxsDa9PeBQ9BxDPBNYBepAUKkjNCSywA4nnoAIBeKc6mt7cmIO3J3Kv4mYk_r2z1Mog_lgmFmzYrLLPTcKNUzFHOtSAjMlz8Tn2uyihbfXJVqu7pCDd6I1yIxvcHbNIgBd01tFTjQpHUh_Pr5sKyhXg0RYLZNOSrREuRqcR04mSfR_E9RsN5k1TReZxhfUY8oacfCeUIMysGOvGB-F9J5DR41DwkxrezAeYUPE8hGBm"

We hope this helps!


#3

Thank you it works now. I was testing the other services and came across an issue when testing the merging of two presentations to one:

this is the curl:
curl -v “http://api.aspose.cloud/v1.1/slides/merged_file.pptx/merge
-d ‘{“PresentationPaths”: [“f:/mufeel-slide-00.ppt”,“f:/hello.pptx”]}’
-X POST
-H “Content-Type: application/json”
-H “Accept: application/json”
-H “Authorization: Bearer XXXX”

I am getting the following error:
{“Message”:“AmazonS3 exception: Error ‘The specified key does not exist.’, Bucket ‘afc-filestorage’, FilePath ‘53819/cb2a18e5-4733-4b5c-adfa-a94c74a39a28/merged_file.pptx’”}

Please let me know the issue


#4

@mufeel

Before calling the POST /slides/{name}/merge API, you need to upload the input files, in your case merged_file.pptx, mufeel-slide-00.ppt and hello.pptx, to Aspose Cloud Storage.

The following cURL example merges the welcome.pptx file with sample.pptx and sample-input.pptx files:

// cURL example to merge pptx files
curl -v "https://api.aspose.cloud/v1.1/slides/welcome.pptx/merge" \
-X POST \
-d '{ "PresentationPaths": [ "sample.pptx", "sample-input.pptx" ], "PresentationPasswords": [ ] }' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ZxgTK_qfThIadwnuUImVEyJCD-LltGaXJt_ej7gn9wdqUBVbRHFI0tq3mSFmvlaYXEos2dHKx5siVIp7unQP7PhSbpStPLf1gP-iypCJEfaQRGmoovHGBB2bo29g85IJUBae98F5mrXRitRcwXrnPAUk-S2K1fFvAp5OmwGFFPtzutX26g21BGFuZQO83QLg7MwKAas4XWWsPyKvVKaIv6AgyUHIwBn-o2G38R9cCCgotWRnpc-1h_6NCGYvKawZ2YsPK1WhvkdS7a-dav6snKxKUSq5p4JA8vZItfOq2LfzA7BNe6OQtOzOoyh6ONmjxJL4mhneUi95jen7tP5bInlN36KIM1f6Ammuy_n_mFK1DMzwVOhuShODqjGhbacpjPbBSLuvo4YpgloqQayMSb1DIgXxWyRZHKuFwRsYse_lOGPF3t1eR8LGrFrWwi_lJ39F-Vbdsc7jjhV94MCDNN_PGHc"

This is what my Cloud Storage looks like:


#5

Thank you, that worked and I was able to merge multiple presentations. I am exploring your api through : https://docs.aspose.cloud/display/slidescloud/Developer+Guide but having issues:

At the moment, I am trying to change the order of slides in a presentation but it keeps failing. the request is :

curl -v “https://api.aspose.cloud/v1.1/slides/blank.pptx/slides?oldPosition=3&newPosition=4
-X POST
-H “Content-Type: application/json”
-H “Accept: application/json”
-H “Authorization: Bearer xxxx”

The file exists in the storage and I am not specifycing the slide numbers out of bound, but I get an error:

HTTP Error 411. The request must be chunked or have a content length.

Could you please let me know what the issue is and also if you have an updated curl documentation for me to try out the other sections


#6

@mufeel

You may test Aspose.Slides REST APIs using Swagger UI. It lets you run the APIs right from your browser.


#7

Okay will try that out, but can I know the issue with the the curl request I made as ultimately I will have to boil it down to pure curl in order to integrate with our application

curl -v “https://api.aspose.cloud/v1.1/slides/blank.pptx/slides?oldPosition=3&newPosition=4”
-X POST
-H “Content-Type: application/json”
-H “Accept: application/json”
-H “Authorization: Bearer xxxx”

The file exists in the storage and I am not specifycing the slide numbers out of bound, but I get an error:

HTTP Error 411. The request must be chunked or have a content length.


#8

@mufeel

The problem is not with the API, but with your cURL request. Please add header Content-Length: 0 in your cURL request, as shown below:

// cURL example to change order of slides
curl -v "https://api.aspose.cloud/v1.1/slides/sample-input.pptx/slides?oldPosition=3&newPosition=1" \
-X POST \
-H "Content-Length: 0" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer xxxxx"

More examples of the similar APIs are given here:


#9

Hi

Is it possible to change multiple positions of slides in one API call, I am currently using

/v1.1/slides/filename.pptx/slides?oldPosition=1&newPosition=2

Would like to know if its possible to pass an array or oldPositions and its corresponding newPositions?

Regards

Mufeel


#10

@mufeel

Unfortunately, at present, we do not provide an API that let you reorder multiple slides in one API call.

We have logged the request (SLIDESCLOUD-542) in our internal tracking software for the implementation of this feature. We will update you here as soon as the feature is implemented.