Page 1 of 1
getting 411 error with POST having empty body or request is causing error
Posted: Thu Jul 13, 2023 11:49 pm
by sgonchigar
Hello,
I am consuming a API that has no request body. There is just a query parameter.
RequestStr = '' ;
ResponseStr = '' ;
Url = https://......................?acknowledgementId=value
rc = http_req('POST': Url : *omit : ResponseStr : *omit: RequestStr :'application/json') ;
Above is resulting in 411 error. Any suggestions?
SetError() #13: HTTP/1.1 411 Length Required
recvresp(): end with 411
recvdoc parms: identity 344
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 344 bytes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
SetError() #13: HTTP/1.1 411 Length Required
http_close(): entered
Re: getting 411 error with POST having empty body or request is causing error
Posted: Fri Jul 14, 2023 3:31 am
by Scott Klement
Why are you using a POST request if you have no data to send? Shouldn't it be a GET request?
That said, a POST should work, it should send Content-Length: 0. Is it not?
Re: getting 411 error with POST having empty body or request is causing error
Posted: Fri Jul 14, 2023 3:08 pm
by sgonchigar
Yes. The Content-Length is not getting passed when the body is empty. Even I thought it should be a GET. The POST requirement doesn't have anything in the body. Just a query parameter.
This is the Curl example that was provided.
curl --location --request POST '
https://apimarketplace.uhc.com/Claims/a ... CD12345678' \ --header 'Authorization: ' \--header 'env: sandbox'
Re: getting 411 error with POST having empty body or request is causing error
Posted: Sat Jul 15, 2023 1:27 am
by Scott Klement
Please try the current beta version from this link:
https://www.scottklement.com/httpapi/beta/
I made a quick bug fix that I think will help. I will need to know if it solves the problem for you, so I can release it to everyone else.
Re: getting 411 error with POST having empty body or request is causing error
Posted: Sun Jul 16, 2023 3:15 am
by sgonchigar
Thank you so much Scott. That worked.
I did have problem installing. Below 3 files were missing during the installation process. I was able to get around by copying from prior version.
File QRPGLESRC in library *LIBL with member NTLM_H not found.
File QRPGLESRC in library *LIBL with member ENCODERR4 not found.
File QRPGLESRC in library *LIBL with member DECODERR4 not found.
Also, when restored the sources were missing member text/description when viewed in PDM
Thank you!!
Re: getting 411 error with POST having empty body or request is causing error
Posted: Mon Jul 17, 2023 4:14 am
by Scott Klement
Sorry about the missing members. I moved the source code to be stored in GitHub, and that was a bug in my tool to generate a library with source members (after pulling the code from GitHub.)
Would you mind trying again? Tell me if that problem is fixed.
You're right, there will be no text descriptions on the members -- that is expected right now (until I come up with a good solution for it.)
Re: getting 411 error with POST having empty body or request is causing error
Posted: Mon Jul 17, 2023 5:36 am
by Scott Klement
I've also added back the text descriptions for the source members, now.
Re: getting 411 error with POST having empty body or request is causing error
Posted: Mon Jul 17, 2023 3:26 pm
by sgonchigar
the missing member and member text issue is resolved. There were two new errors. I took "I" on both these.
570 - CRTPNLGRP PNLGRP(LIBHTTP/HTTPAPI) SRCFILE(*LIBL/QCMDSRC)
SRCMBR(HTTPAPIPNL)
Warning messages issued when panel group HTTPAPI created.
573 - DLTSPLF FILE(HTTPAPI) JOB(*) SPLNBR(*LAST)
578 - CRTCMD CMD(LIBHTTP/HTTPAPI) PGM(*LIBL/HTTPCMDR4)
SRCFILE(*LIBL/QCMDSRC) HLPPNLGRP(*LIBL/HTTPAPI) HLPID(*CMD)
PRDLIB(LIBHTTP)
Command HTTPAPI not created in library LIBHTTP.
Function check. CPF0201 unmonitored by INSTALL at statement 578,
instruction X'0629'.
CPF0201 received by INSTALL at 578. (C D I R)
CPF0201 received by INSTALL at 578. (C D I R)
...........
643 - CRTCMD CMD(LIBHTTP/EXAMPLE9) PGM(LIBHTTP/EXAMPLE9)
SRCFILE(*LIBL/QCMDSRC) PRDLIB(LIBHTTP)
Command EXAMPLE9 not created in library LIBHTTP.
Function check. CPF0201 unmonitored by INSTALL at statement 643,
instruction X'06EC'.
CPF0201 received by INSTALL at 643. (C D I R)