0% found this document useful (0 votes)
105 views

How To Setup API

To use the PDF Services API, there is a 5 step process: 1. Get an access token by providing client ID and secret. 2. Upload an asset by getting an upload URI and using it to upload the file to cloud storage. 3. Create a job using the asset ID and choose a PDF operation. 4. Poll the job status location header until the job is done or failed. 5. Download the processed asset using the download URI once the job is complete.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

How To Setup API

To use the PDF Services API, there is a 5 step process: 1. Get an access token by providing client ID and secret. 2. Upload an asset by getting an upload URI and using it to upload the file to cloud storage. 3. Create a job using the asset ID and choose a PDF operation. 4. Poll the job status location header until the job is done or failed. 5. Download the processed asset using the download URI once the job is complete.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Step 1 : Getting the access token

PDF Services API endpoints are authenticated endpoints. Getting an access token is a two-
step process :

1. Get Credentials Invoking PDF Services API requires an Adobe-provided credential.


To get one, click here, and complete the workflow. Be sure to copy and save the
credential values to a secure location.
2. Retrieve Access Token The PDF Services APIs require an access_token to
authorize the request. Use the "Get AccessToken" API from the Postman Collection
with your client_id, client_secret (mentioned in the pdfservices-api-
credentials.json file downloaded in 1) to get the access_token OR directly use the
below mentioned cURL to get the access_token.

Rest API
Copy
1curl --location 'https://pdf-services.adobe.io/token' \
2--header 'Content-Type: application/x-www-form-urlencoded' \
3--data-urlencode 'client_id={{Placeholder for Client ID}}' \
4--data-urlencode 'client_secret={{Placeholder for Client Secret}}'

Step 2 : Uploading an asset

After getting the access token, we need to upload the asset. Uploading an asset is a two-
step process :

1. First you need to get an upload pre-signed URI by using the following API.

You can read more about the API in detail here.


Rest API
Copy
1curl --location --request POST 'https://pdf-services.adobe.io/assets' \
2--header 'X-API-Key: {{Placeholder for client_id}}' \
3--header 'Authorization: Bearer {{Placeholder for token}}' \
4--header 'Content-Type: application/json' \
5--data-raw '{
6 "mediaType": "{{Placeholder for mediaType}}"
7}'

2. On getting a 200 response status from the above API, use the uploadUri field in the
response body of the above API to upload the asset directly to the cloud provider
using a PUT API call. You will also get an assetID field which will be used in creating
the job.

Rest API
Copy
1curl --location -g --request PUT 'https://dcplatformstorageservice-prod-us-east-
1.s3-accelerate.amazonaws.com/b37fd583-1ab6-4f49-99ef-d716180b5de4?X-Amz-Security-
Token={{Placeholder for X-Amz-Security-Token}}&X-Amz-Algorithm={{Placeholder for
X-Amz-Algorithm}}&X-Amz-Date={{Placeholder for X-Amz-Date}}&X-Amz-
SignedHeaders={{Placeholder for X-Amz-SignedHeaders}}&X-Amz-Expires={{Placeholder
for X-Amz-Expires}}&X-Amz-Credential={{Placeholder for X-Amz-Credential}}&X-Amz-
Signature={{Placeholder for X-Amz-Signature}}' \
2--header 'Content-Type: application/pdf' \
3--data-binary '@{{Placeholder for file path}}'

Step 3 : Creating the job

To create a job for the operation, please use the assetID obtained in Step 2 in the API
request body. On successful job submission you will get a status code of 201 and a
response header location which will be used for polling.

For creating the job, please refer to the corresponding API spec for the particular PDF
Operation.

Step 4 : Fetching the status

Once the job is successfully created, you need to poll the at the location returned in
response header of Step 3 by using the following API

You can read more about the API in detail here.


Rest API
Copy
1curl --location -g --request GET
'https://pdf-services.adobe.io/operation/compresspdf/{{Placeholder for job
id}}/status' \
2--header 'Authorization: Bearer {{Placeholder for token}}' \
3--header 'x-api-key: {{Placeholder for client id}}'
Instead of using the status API to check the job status, you have the option to receive job completion
notifications through Webhook. For more information, please refer the documentation.

Step 5 : Downloading the asset

On getting 200 response code from the poll API, you will receive a status field in the response
body which can either be in progress, done or failed.

If the status field is in progress you need to keep polling the location until it changes
to done or failed.

If the status field is done the response body will also have a download pre-signed URI in
the dowloadUri field, which will be used to download the asset directly from cloud provider
by making the following API call

You can read more about the API in detail here.


Rest API
Copy
curl --location -g --request GET 'https://dcplatformstorageservice-prod-us-east-
1.s3-accelerate.am

You might also like