INVALID_MULTIPART_REQUEST

Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

$response = Http::withHeaders([
'Authorization' => 'Bearer XYZ',
'X-API-Key' => 'ABC123',
'Content-Type' => 'multipart/form-data',
])->post('https://cpf-ue1.adobe.io/ops/:create', $data);

 

In Laravel i'm trying the endpoint to create a PDF. I use the example data from the document services api documentation: https://documentcloud.adobe.com/document-services/index.html#post-documentGeneration

 

{
"cpf:engine": {
"repo:assetId": "urn:aaid:cpf:Service-52d5db6097ed436ebb96f13a4c7bf8fb"
},
"cpf:inputs": {
"documentIn": {
"dc:format": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"cpf:location": "InputFile0"
},
"params": {
"cpf:inline": {
"outputFormat": "pdf",
"jsonDataForMerge": {
"customerName": "Kane Miller",
"customerVisits": 100,
"itemsBought": [
{
"name": "Sprays",
"quantity": 50,
"amount": 100
},
{
"name": "Chemicals",
"quantity": 100,
"amount": 200
}
],
"totalAmount": 300,
"previousBalance": 50,
"lastThreeBillings": [
100,
200,
300
],
"photograph": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP88h8AAu0B9XNPCQQAAAAASUVORK5CYII="
}
}
}
},
"cpf:outputs": {
"documentOut": {
"dc:format": "application/pdf",
"cpf:location": "multipartLabel"
}
}
}

 

I get the following reply:

 

array:5 [  "requestId" => "fmbhttWQ9VUrmMYuuz2sMjvc28CclxA1"
  "type" => "Bad Request"
  "title" => "Not a multipart request. Aborting."
  "status" => 400
  "report" => "{"error_code":"INVALID_MULTIPART_REQUEST"}"]

 

What's wrong here?

TOPICS
Document Generation API

Views

31

Likes

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation