Getting Failed to load PDF issue in Postman while hitting APIGEE API.
We have a Apigee API which is deployed as hosted target (Node Js - Express framework). And Node Js code serves the purpose of swagger validations, Incoming/Outgoing reqs,responses translations, Mappings of parameters from Apigee to backend and vice versa.
A new API "Retrieve Document" is created in Apigee which gets the PDF file from backend and displays the same to frontend UI that consumes our API. When we are hitting the backend service URL directly we are able to view the PDF contents in Postman. But when we hit the APIGEE API URL we are getting the blank document in postman. Could anyone provide some help on this please.
Below is the Swagger representation in our Node Js code.
/project/{projectId}/document/{documentId}:
get:
tags:
- order
summary: Retrieve Document
description: ''
operationId: retrieveDoc
produces:
- application/pdf
parameters:
- in: path
name: projectId
type: string
description: the projectId
required: true
- in: path
name: documentId
type: string
description: the doc id
required: true
- in: query
name: ***
type: string
description: ***.
required: true
responses:
'200':
description: Complete
schema:
type: string
format: binary
'400':
$ref: '#/responses/BadRequest'
'401':
$ref: '#/responses/Unauthorized'
'404':
$ref: '#/responses/NotFound'
'500':
$ref: '#/responses/ServerError'
I don't know, but, if I were trying to solve this problem, I would try running the nodejs server that is currently your hosted target, as a standalone server. You can run it outside the Apigee environment, outside the hosted target system. Just run it on your own developer workstation.
Then invoke it from there. Send in an HTTP request to that test instance.
Observe the results, and even use nodejs debugging to figure out why your PDFs are getting corrupted.