I am trying to post a JSON body to a RESTful API. Im having issue with post, the request isnt happening. I just recently discoved RMNet and have HttpGet requests working with my own parsing. Everything i can find is on xml and SOAP usage with post.
IDENTIFICATION DIVISION.
PROGRAM-ID. EXECNODE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WSOK PIC X.
01 DESTINATION-URL PIC X(200)
VALUE "localhost:5001/.../cobol".
01 content-type PIC X(45)
value "application/json; charset=utf-8".
01 ws-request-len PIC 9(5).
01 request-pointer USAGE POINTER.
01 response-pointer USAGE POINTER.
01 http-return-code PIC 9(03).
01 http-return-code-text PIC X(40).
01 ws-status-code PIC S9(03) VALUE 0.
01 ws-error-pointer USAGE POINTER.
01 ws-error-len PIC 9(04).
LINKAGE SECTION.
01 lk-error-message PIC X(1000).
01 lk-response-payload PIC X(1000000).
01 lk-request-body PIC X(20)
value '{"test":"value"}'.
PROCEDURE DIVISION.
000-BEGIN-PROGRAM SECTION.
100-EXEC-NODE.
CALL "NetInit" GIVING WS-STATUS-CODE.
ACCEPT WSOK.
set address of lk-request-body to request-pointer.
CALL 'HttpPost' USING
destination-url,
content-type,
request-pointer,
response-pointer
GIVING http-return-code.
call "HttpGetReturnCode" using http-return-code
giving ws-status-code.
evaluate ws-status-code
when 200
move "OK" to http-return-code-text.
display http-return-code-text.
ACCEPT WSOK.
EXIT PROGRAM.



