Upload Microsoft PowerPoint Presentation to cloud storage with cURL command using Aspose.Slides REST API

I got an error when I tried to upload to storage. I need to know how to deal with it.

“Uploading a file from Cloud Storage”: /slides/storage/file/{path}

  • Uploading from local to storage

  • The “–binary” option in “cURL Example” was changed to “–data-binary” because the following error occurred.
    curl: option --binary: is unknown

  • The version of curl is as follows.
    curl --version
    curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
    Release-Date: [unreleased]
    Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
    Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL


curl  -v -X POST "https://api.aspose.cloud/v3.0/slides/storage/file/presentation_images_1.pptx" "Content-Type:application/octet-stream" -H "Authorization: Bearer [TOKEN]" --ssl-no-revoke --data-binary  @C:/Temp/pptsample.pptx
< HTTP/1.1 405 Method Not Allowed
< Date: Tue, 12 May 2020 07:14:10 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Server: Kestrel
< Allow: GET
< Allow: PUT
< Allow: DELETE
< Strict-Transport-Security: max-age=2592000
* HTTP error before end of send, stop sending
<
{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI 'https://api.aspose.cloud/v3.0/slides/storage/file/presentation_images_1.pptx' with API version '3.0' does not support HTTP method 'POST'.","description":"Operation Failed. ","innerError":{"requestId":null,"date":"2020-05-12T07:14:10.0088652Z"}}}* Closing connection 0
* schannel: shutting down SSL/TLS connection with api.aspose.cloud port 443
* schannel: failed to send close msg: Socket not ready for send/recv (bytes written: 0)
* schannel: clear security context handle
Note: Unnecessary use of -X or --request, POST is already inferred.
* Port number ended with 'a'
* Closing connection -1
curl: (3) Port number ended with 'a'

@yoshios

We are truly sorry for the inconvenience. Unfortunately there is typo error in the documentation. UploadFile method is PUT method instead of POST. We will fix the documentation asap. Please use following cURL command for uploading file to the cloud storage.

curl  -v -X PUT "https://api.aspose.cloud/v3.0/slides/storage/file/presentation_images_1.pptx" 
-H "Content-Type:application/octet-stream" 
-H "authorization: Bearer [Access_Token]" 
--ssl-no-revoke 
--data-binary @C:/Temp/AccessSlides.pptx

I was able to run it successfully with the above command. Thank you very much.

1 Like