Free Support Forum - aspose.cloud

Using curl to test API calls -- tokens


#1

Unfortunately I can’t get https://apireference.aspose.cloud/slides/ to work, so I’m trying raw curl examples…

[Alternatively, do you have an packaged Postman [https://www.getpostman.com/] samples]?

What am I doing wrong here:

Step 1 get a token:
curl -v “https://api.aspose.cloud/oauth2/token” \

-X POST
-d ‘grant_type=client_credentials&client_id=0000000-0000-0000-0000-80f904d730bf&client_secret=000000768f4e1f53e7fb4a8fab0108d’
-H “Content-Type: application/x-www-form-urlencoded”
-H “Accept: application/json”

(note, modified client_id and client_secret for public posting)

Got a response:

{“access_token”:“xxxxxxF8HHaEEdfAcFCo5wzbN7L5nfyeiak9NPLlcNLndorNVM2oQI_Rz88nGTWDBsWMwdz6q2ZIgHV2CGJi78Iw6kFkR6BnrSMkQkgxkALfb1XWHsYWAApKw872uCllF7n7tgzZ51A60sHH7ecb0Z9HF_RqmWeYW8BknZBZR8xZ2veZgODaBlI_b-d3oUUMq6HZuC6bvckrfl8QEK_kYRUtu4w5ToeEy0H2c7dMkgC2oZar4KaIIOs20qK9hccGExPedxdKBoL3MxUERsjN1ELjCziGN3AKiarGHI-kAXtKTLycCALSNtm4Cou5kp-8VfZ53RYK_SO5ZSOcJ-0Q1bncniP_-ArROfQ8YhHPX7H_CoOXWBi2pUqKGnU31fwfOS8g51j-cRUxCwxlHKm_Dp_c-tS4aNtNJBHNinhT29qVZlt”,“token_type”:“bearer”,“expires_in”:86399,“refresh_token”:“5ae0c1acc1d34f01a415afe136fba619”,“client_id”:“e57cadbf-0614-437a-b926-80f904d730bf”,“clientRefreshTokenLifeTimeInMinutes”:“525600”,".issued":“Mon, 15 Jul 2019 16:54:31 GMT”,".expires":“Tue, 16 Jul 2019 16:54:31 GMT”}[klubar@vsYWAApKw872uCllF7n7tgzZ51A60sHH7ecb0Z9HF_RqmWeYW8BknZBZR8xZ2veZgODaBlI_b-d3oUUMq6HZuC6bvckrfl8QEK_kYRUtu4w5ToeEy0H2c7dMkgC2oZar4KaIIOs20qK9hccGExPedxdKBoL3MxUERsjN1ELjCziGN3AKiarGHI-kAXtKTLycCALSNtm4Cou5kp-8VfZ53RYK_SO5ZSOcJ-0Q1bncniP_-ArROfQ8YhHPX7H_CoOXWBi2pUqKGnU31fwfOS8g51j-cRUxCwxlHKm_Dp_c-tS4aNtNJBHNinhT29qVZlt",“token_type”:“bearer”,“expires_in”:86399,“refresh_token”:“5ae0c1acc1d34f01a415afe136fba619”,“client_id”:“e57cadbf-0614-437a-b926-80f904d730bf”,“clientRefreshTokenLifeTimeInMinutes”:“525600”,".issued":“Mon, 15 Jul 2019 16:54:31 GMT”,".expires":“Tue, 16 Jul 2019 16:54:31 GMT”}

(modified access token for public posting)

Then tried to execute call:

curl -X GET “https://api.aspose.cloud/v3.0/slides/QBE%20IMCA%20Entry.pptx/slides/1/textItems?withEmpty=true” -H “accept: application/json” -H “authorization: Bearer xxxxF8HHaEEdfAcFCo5wzbN7L5nfyeiak9NPLlcNLndorNVM2oQI_Rz88nGTWDBsWMwdz6q2ZIgHV2CGJi78Iw6kFkR6BnrSMkQkgxkALfb1XWHsYWAApKw872uCllF7n7tgzZ51A60sHH7ecb0Z9HF_RqmWeYW8BknZBZR8xZ2veZgODaBlI_b-d3oUUMq6HZuC6bvckrfl8QEK_kYRUtu4w5ToeEy0H2c7dMkgC2oZar4KaIIOs20qK9hccGExPedxdKBoL3MxUERsjN1ELjCziGN3AKiarGHI-kAXtKTLycCALSNtm4Cou5kp-8VfZ53RYK_SO5ZSOcJ-0Q1bncniP_-ArROfQ8YhHPX7H_CoOXWBi2pUqKGnU31fwfOS8g51j-cRUxCwxlHKm_Dp_c-tS4aNtNJBHNinhT29qVZlt”

(putting in the bearer token from my get token CURL)

I get the following error:
{“error”:{“code”:“error”,“message”:“You must either set Authority or IntrospectionEndpoint”,“description”:“Operation Failed.”,“innerError”:{“requestId”:null,“date”:“2019-07-15T17:18:53.628759Z”}}}

What am I missing?


#2

@klubar

Thanks for your inquiry. I am afraid we have not Postman samples but cURL samples. You can find sample cURL examples on each documentation page.

Please note API version 3.0 only supports JWT(JSON Web Token) authentication. Please check following sample cURL command to get JWT for authentication.

// First get JSON Web Token for authentication
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"