Download billing document in PDF format. This call will trigger the PDF generation in SAP and deliver the output as a response. The PDF download functionality requires OSS note 508569 to be applied in your SAP backend system.
/cnbs/v1/invoices/id/format/pdf
GET | POST
JSON Payload:
{ "document_detail": { "billing_document_number": "90038990", "document_type": "01" } }
cURL:
curl -X POST "https://<<your.server.here>>/cnbs/v1/invoices/id/format/pdf?sap-client=800&sap-language=EN&apiid=CNBSMV01P" -H "accept: application/pdf" -H "content-type: application/json" -H "cnbssysid: gPuM1VyY1dxlTE2MEs2yajJUkX3/4+2Pw1alRw4BOtI=" -d "{ \"document_detail\": { \"billing_document_number\": \"90038990\", \"document_type\": \"01\" }}"
cURL:
curl -X GET "https://<<your.server.here>>/cnbs/v1/invoices/id/format/pdf?sap-client=800&sap-language=EN&apiid=CNBSMV01R&billing_document_number=90038990&document_type=01" -H "accept: application/pdf" -H "content-type: application/json" -H "cnbssysid: gPuM1VyY1dxlTE2MEs2yajJUkX3/4+2Pw1alRw4BOtI="
A successful Response with code 200, will be of content type “application/pdf”. Standard filename is billing document number with a .pdf extension. These response header fields will be present:
"content-length": "nnn", "content-disposition": "attachment; filename=nnnnnnnnnn.pdf", "content-type": "application/pdf"
A bad response with code 400 will return the following status fields:
access-control-allow-credentials: true access-control-allow-headers: Authorization,cnbssysid,DNT,X-CustomHeader,api_key,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type access-control-allow-methods: GET, POST, OPTIONS access-control-allow-origin: * access-control-expose-headers: Authorization,cnbssysid,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range cnbssessid: connection: keep-alive content-disposition: attachment; filename=0090038990.pdf content-length: 12359 content-type: application/pdf date: Wed, 31 May 2017 12:29:01 GMT server: nginx/1.4.6 (Ubuntu)