Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Getting "not authorised to perform the operation." while trying to combinepdf

New Here ,
Feb 17, 2025 Feb 17, 2025

I'm trying to use the combine pdf function but I always get this:

{"error":{"code":"UNAUTHORIZED","message":"Not authorised to perform the operation."}}

Before the final "operation/combinepdf " request I succesfully get an access token, get two urls with "assets" and upload the two files I need to combine.

Also tried to get download uri with "/assets/{assetId}" and it works correctly.

Anyone can help me?

TOPICS
PDF Services API
131
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 18, 2025 Feb 18, 2025

Can you supply your code

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 18, 2025 Feb 18, 2025

Here's the code:

$url="https://pdf-services-ue1.adobe.io/token";
$headers=array(
  'Content-Type:application/x-www-form-urlencoded',
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,"client_id={$cmyclientid}&client_secret={$mysecret}");
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
$response=curl_exec($ch);
curl_close($ch);
$token=json_decode($response,true);
//URL FILE 1 -----------------------------------------------------------------------------
$url="https://pdf-services-ue1.adobe.io/assets";
$headers=array(
  'Content-Type:application/json',
	"Authorization:Bearer {$token['access_token']}",
	"x-api-key: {$cmyclientid}",
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,'{"mediaType":"application/pdf"}');
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
$response=curl_exec($ch);
curl_close($ch);
$asset1=json_decode($response,true);
//UPLOAD FILE 1 -----------------------------------------------------------------------------
$url=$asset1['uploadUri'];
$headers=array(
  'Content-Type: application/pdf',
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,'PUT');
curl_setopt($ch,CURLOPT_POSTFIELDS,file_get_contents('Manual-ENG-HopperCD-Discriminator-II.pdf'));
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
$response=curl_exec($ch);
curl_close($ch);
//URL FILE 2 -----------------------------------------------------------------------------
$url="https://pdf-services-ue1.adobe.io/assets";
$headers=array(
  'Content-Type:application/json',
	"Authorization:Bearer {$token['access_token']}",
	"x-api-key: {$cmyclientid}",
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,'{"mediaType":"application/pdf"}');
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
$response=curl_exec($ch);
curl_close($ch);
$asset2=json_decode($response,true);
//UPLOAD FILE 2 -----------------------------------------------------------------------------
$url=$asset2['uploadUri'];
$headers=array(
  'Content-Type: application/pdf',
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,'PUT');
curl_setopt($ch,CURLOPT_POSTFIELDS,file_get_contents('modulo_imposta_bollo.pdf'));
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
$response=curl_exec($ch);
curl_close($ch);
//COMBINE FILE -----------------------------------------------------------------------------
$url="https://pdf-services-ue1.adobe.io/operation/combinepdf";
$headers=array(
  'Content-Type:application/json',
	"Authorization:Bearer {$token['access_token']}",
	"x-api-key: {$cmyclientid}",
);
$body='{"assets":[{"assetID":"'.$asset1['assetID'].'"},{"assetID":"'.$asset2['assetID'].'"}]}';
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$body);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLINFO_HEADER_OUT,true);
echo $response=curl_exec($ch);
curl_close($ch);
$information=curl_getinfo($ch);
print_r($information);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2025 Mar 19, 2025
LATEST

Have the same issue while trying to extract text from a PDF.  I have isolated the problem to be from the call to convert -- all preceding authetication, asset upload, etc, works. Anybody have updates?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources