Domain API: Specifying the language for a document printout (v.22)

Back in version 2019.1 this Domain API feature for getting a printout for a document (aka GetPrintout) was introduced.

https://support.erp.net/hc/en-us/articles/360016126414

In short, if you send such a request,

POST /api/domain/odata/Crm_Invoicing_Invoices(51a63a99-c96d-4876-b205-fced610143ae)/GetPrintout HTTP/1.1
Host: demodb.my.erp.net
Content-Type: application/json

{
    "fileFormat": "pdf",
    "printout": {
        "@odata.id": "General_Printouts(f5229037-b420-46a4-81a0-f11f7d112879)"
    }
}

You'll receive a printout of the corresponding invoice as a pdf file, base64 encoded.

In English.

But you don't always need a printout in English, do you?

It's now possible to specify the language of the printout. Here's how,

POST /api/domain/odata/Crm_Invoicing_Invoices(51a63a99-c96d-4876-b205-fced610143ae)/GetPrintout HTTP/1.1
Host: demodb.my.erp.net
Content-Type: application/json
Accept-Language: de { "fileFormat": "pdf", "printout": { "@odata.id": "General_Printouts(f5229037-b420-46a4-81a0-f11f7d112879)" } }

The only difference is the additional HTTP request header Accept-Language: de. This way, the result will be the same printout, but in German (of course if you have specified the corresponding translations in your multilanguage strings).

If you are not OK, adding a new HTTP header, you have two more options:

  • to specify a URL parameter culture=de
  • or set a cookie, containing the following key=value .AspNetCore.Culture=de

---

More information is available in our official documentation:

https://docs.erp.net/dev/domain-api/common-tasks/change-language.html

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Dobri Kostadinov

    hello,

    I pass bg or en for Accept-Language header but the Printout is always coming in English. We are sure that there are translations in Bulgarian language. Why is that happening?

  • 0
    Avatar
    Peter Kostov [ERP.NET]

    Hi, 

    Please create a new forum post (or client ticket) and provide your exact ERP.net version as well as the HTTP request you're using.

    Regards,
    Peter Kostov

Please sign in to leave a comment.
Powered by Zendesk