We are trying to pass a json data to an APIM server using HTTPAPI in RPGLE. We tried to provide the subscription key using http_setAuth method but they are asking to send this in header. How to define the subscription key in Header to connect an APIM server using RPGLE? Following is our program.
* =================================================================
* Program Id : WT1
* File Desc : Test AS400/web service for Pick Pack shiphip
* Author : Thisaru Dheerarathna
* Date : 25/09/2024
* =================================================================
/if defined(*CRTBNDRPG)
H DFTACTGRP(*NO)
/endif
H BNDDIR('HTTPAPI')
/copy httpapi_h
/copy ifsio_h
D QCMDEXC pr extpgm('QCMDEXC')
D command 200A const
D length 15P 5 const
D msg s 52A
H BNDDIR('HTTPAPI')
/copy httpapi_h
/copy ifsio_h
D QCMDEXC pr extpgm('QCMDEXC')
D command 200A const
D length 15P 5 const
D msg s 52A
D rc s 10I 0
D url S 256A
D jsonFilePath S 256A
D ContentType s 256A
**FREE
http_debug(*on:'/tmp/baba-diagnostic-log.txt');
jsonFilePath =
'/NPS/PMMK/PMMK321_20241006_230519_20241006230519114.JSON';
http_setOption('content-type': 'application/json');
rc = http_req( 'POST'
:'https://endpoint URL'
: '/tmp/testpost.html' // File to receive
: *omit // String to receiv
: jsonFilePath // File to send
: *omit); // String to send
Any guidance will be helpful. If you need any further information, feel free to contact me.
Subscription Key in Header
Subscription Key in Header
Last edited by balinabk on Wed Oct 16, 2024 1:45 am, edited 1 time in total.
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Subscription Key in Header
What is the header you need to pass it in? Do you have an example of what it looks like?
Re: Subscription Key in Header
Hi Scott,
We need to pass the following values for authorization.
Key name and key value lime api-key: "key value".
If you need any further information, feel free to contact me.
We need to pass the following values for authorization.
Key name and key value lime api-key: "key value".
If you need any further information, feel free to contact me.
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Subscription Key in Header
Thanks for the information Scott. We managed to resolve the issue by using additional headers exit point process in HTTPAPI.