Hi - I am trying to call API using mirth as connector.
COBOL Statement [fAILING with HTTP-RESPONSE = 500]
CONTENTTYPE=application/json
POST-ADDRESSD is 250 char
CALL "HttpPost" USING POST-ADDRESSD CONTENTTYPE REQUEST-PAYLOAD RESPONSE-PAYLOAD GIVING RESPONSE-STATUS.
Curl form linux command line is working fine
syntax:
curl -X 'POST' 'url' -H 'accept: application/json' -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{payload}'
Question
1. I am not able to find documentation on RMNet. Can you please route me to correct direction ?
2. How to pass token to httppost ?
3. Is there way to generate curl syntax from RMNet [my understanding is RMNet is wrapper for curl]
#curl#RMCOBOL#RMNet1) The documentation is installed with the RM/COBOL runtime. Look in the RMnet directory for rmnet.pdf. Hmmm. The PDF that is shipped has a copyright of 2017. I'm thinking that its out of date.
2) There is an optional parameter before the GIVING in the call to HttpPost containing "extra-headers", From the documentation "An optional alphanumeric item specifying extra headers to be added to the HTTP header. This argument consists of name/value pairs separated by hex x”00”, and ended with two x”00”’s." I hope that covers it. The documentation for the HTTP Post is up to date.
3) No, RMNet calls the curl API directly.
1) The documentation is installed with the RM/COBOL runtime. Look in the RMnet directory for rmnet.pdf. Hmmm. The PDF that is shipped has a copyright of 2017. I'm thinking that its out of date.
2) There is an optional parameter before the GIVING in the call to HttpPost containing "extra-headers", From the documentation "An optional alphanumeric item specifying extra headers to be added to the HTTP header. This argument consists of name/value pairs separated by hex x”00”, and ended with two x”00”’s." I hope that covers it. The documentation for the HTTP Post is up to date.
3) No, RMNet calls the curl API directly.
Thanks Mike.. I am struggling to create extra-headers piece of curl
-H 'accept: application/json' -H 'Authorization: Bearer token'
Is there any thread or formatting [as per COBOL data variable] for extra-parameters help you can provide?
Thanks Mike.. I am struggling to create extra-headers piece of curl
-H 'accept: application/json' -H 'Authorization: Bearer token'
Is there any thread or formatting [as per COBOL data variable] for extra-parameters help you can provide?
Have you found the RMNet PDF? There are calls there for setting login options. (However, my guess is that token is something different and those calls won't help you.) I would recommend using the STRING verb for building the extra-headers parameter. How much COBOL do you know? What does the token look like? How does it get into your COBOL program?
Have you found the RMNet PDF? There are calls there for setting login options. (However, my guess is that token is something different and those calls won't help you.) I would recommend using the STRING verb for building the extra-headers parameter. How much COBOL do you know? What does the token look like? How does it get into your COBOL program?
reg. Have you found the RMNet PDF?
<swapnil> Yes.. But there are no sample only syntax. Trying to understand how to build extra-headers
reg. There are calls there for setting login options. (However, my guess is that token is something different and those calls won't help you.)
<swapnil> True. I agree
reg. I would recommend using the STRING verb for building the extra-headers parameter. How much COBOL do you know?
<swapnil> I use STRING only. Has good hand in Cobol.
reg. What does the token look like?
<swapnil> Token looks like
Authorization: Bearer FFFBFC-12345-7XX9-X123-123XXXX1XX2X9
reg. How does it get into you COBOL program?
<swapnil> hardcoded in program
Build EXTRAHEADER like
STRING "accept: application/json " DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
" Authorization: Bearer " DELIMITED BY SIZE
"FFFBFC-12345-7XX9-X123-123XXXX1XX2X9" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
Still No luck.. In absence of sample getting difficult to relate.
reg. Have you found the RMNet PDF?
<swapnil> Yes.. But there are no sample only syntax. Trying to understand how to build extra-headers
reg. There are calls there for setting login options. (However, my guess is that token is something different and those calls won't help you.)
<swapnil> True. I agree
reg. I would recommend using the STRING verb for building the extra-headers parameter. How much COBOL do you know?
<swapnil> I use STRING only. Has good hand in Cobol.
reg. What does the token look like?
<swapnil> Token looks like
Authorization: Bearer FFFBFC-12345-7XX9-X123-123XXXX1XX2X9
reg. How does it get into you COBOL program?
<swapnil> hardcoded in program
Build EXTRAHEADER like
STRING "accept: application/json " DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
" Authorization: Bearer " DELIMITED BY SIZE
"FFFBFC-12345-7XX9-X123-123XXXX1XX2X9" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
Still No luck.. In absence of sample getting difficult to relate.
I think that you're on the right track. I'm worried that the 500 error from the server indicates a different type of problem. I'm trying to find an example for you.
reg. Have you found the RMNet PDF?
<swapnil> Yes.. But there are no sample only syntax. Trying to understand how to build extra-headers
reg. There are calls there for setting login options. (However, my guess is that token is something different and those calls won't help you.)
<swapnil> True. I agree
reg. I would recommend using the STRING verb for building the extra-headers parameter. How much COBOL do you know?
<swapnil> I use STRING only. Has good hand in Cobol.
reg. What does the token look like?
<swapnil> Token looks like
Authorization: Bearer FFFBFC-12345-7XX9-X123-123XXXX1XX2X9
reg. How does it get into you COBOL program?
<swapnil> hardcoded in program
Build EXTRAHEADER like
STRING "accept: application/json " DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
" Authorization: Bearer " DELIMITED BY SIZE
"FFFBFC-12345-7XX9-X123-123XXXX1XX2X9" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
Still No luck.. In absence of sample getting difficult to relate.
I still don't have an example, but I'm thinking that you code needs to be:
STRING "accept" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
"application/json" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
"Authorization" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
"Bearer " DELIMITED BY SIZE
"FFFBFC-12345-7XX9-X123-123XXXX1XX2X9" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
x"00" DELIMITED BY SIZE
In other words, the keyword and value are separate nul terminated things, and you shouldn't use a ": " to separate them.