I’m trying to work on fetching the automatically generated PDF for an advice and guidance request, using https://digital.nhs.uk/developer/api-catalogue/e-referral-service-fhir#post-/STU3/CommunicationRequest/-ubrn-/$ers.generateCRI in integration test.
But get back either a 405 error from Node, (a code not listed in the docs (!)) or a 411 error from Curl.
Any ideas ?
$ curl -v -X POST "https://int.api.service.nhs.uk/referrals/FHIR/STU3/CommunicationRequest/000049837371/\$ers.generateCRI" -H "accept: application/pdf" -H "nhsd-end-user-organisation-ods: R69" -H "nhsd-ers-business-function: SERVICE_PROVIDER_CLINICIAN_ADMIN" -H "nhsd-ers-on-behalf-of-user-id: 021600556514" -H "x-correlation-id: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA" -H "authorization: Bearer 8zfGN7IAyfmtCF9fr3rZWPW4CF8v"
* Host int.api.service.nhs.uk:443 was resolved.
* IPv6: (none)
* IPv4: 35.234.138.138
* Trying 35.234.138.138:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL Trust Anchors:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 / secp256r1 / rsaEncryption
* ALPN: server accepted http/1.1
* Server certificate:
* subject: C=GB; L=London; O=NHS England; CN=int.api.service.nhs.uk
* start date: Mar 10 00:00:00 2026 GMT
* expire date: Sep 24 23:59:59 2026 GMT
* issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1
* Certificate level 0: Public key type RSA (4096/152 Bits/secBits), signed using sha256WithRSAEncryption
* Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* subjectAltName: "int.api.service.nhs.uk" matches cert's "int.api.service.nhs.uk"
* SSL certificate verified via OpenSSL.
* Established connection to int.api.service.nhs.uk (35.234.138.138 port 443) from 172.17.3.14 port 49514
* using HTTP/1.x
> POST /referrals/FHIR/STU3/CommunicationRequest/000000070000/$ers.generateCRI HTTP/1.1
> Host: int.api.service.nhs.uk
> User-Agent: curl/8.18.0
> accept: application/pdf
> nhsd-end-user-organisation-ods: R69
> nhsd-ers-business-function: SERVICE_PROVIDER_CLINICIAN_ADMIN
> nhsd-ers-on-behalf-of-user-id: 021600556514
> x-correlation-id: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA
> authorization: Bearer 8zfGN7IAyfmtCF9fr3rZWPW4CF8v
>
* Request completely sent off
< HTTP/1.1 411 Length Required
< Date: Tue, 18 Aug 2026 15:37:19 GMT
< Content-Type: application/json
< Content-Length: 122
< Connection: keep-alive
< Content-Security-Policy: frame-ancestors 'none'
< X-Frame-Options: DENY
< X-XSS-Protection: 1
< X-Content-Type-Options: nosniff
< Strict-Transport-Security: max-age=86400
<
* Connection #0 to host int.api.service.nhs.uk:443 left intact
{"fault":{"faultstring":"Content-Length is missing","detail":{"errorcode":"messaging.adaptors.http.flow.LengthRequired"}}}