Web API on IBMi - how to call?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Web API on IBMi - how to call?

Post by Joerg Hamacher »

Hello,

now that I have successfully sted my Web API on my local machine, I have checked everything in to the IBMi. This is the platform where the API has to run.

Unfortunately, I am now unable to access the object via Postman. The response is every time I try:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>404 Nicht gefunden</TITLE>
</HEAD>
<BODY>
<H1>Nicht gefunden</H1>
<p>The requested URL was not found on this server.</p>
</body>
</html>


In the Visual LANSA options the Web Page Base URL is set to http://MyIBMi:8875/l15pgmlib/, this access for Web Pages works fine.

When I check in the server module, an object is created in the IBMi program library SMH_V60P15. The server module in VL is called WH02, the object in the library SMH_V60P15 gets the name §WH02 during check-in. Partition name is V60.

In the httpd.conf for my IBMi HTTP Server L15PGMLIB I added the following:
Alias /smh /QSYS.LIB/SMH_V60P15.LIB

Operation path is /Preis.

So i tried things like:
http://MyIBMi:8875/smh/v60/wh02/preis
http://MyIBMi:8875/smh/wh02/preis
http://MyIBMi:8875/smh/v60/§wh02/preis
http://MyIBMi:8875/smh/§wh02/preis
http://MyIBMi:8875/l15pgmlib/v60/WH02/Preis
http://MyIBMi:8875/l15pgmlib/WH02/Preis


Nothing works.
What error in thinking am I making here? What is the correct configuration for the call? What is the correct setup in this case?

Thank you in advance and best regards.
Jörg
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Web API on IBMi - how to call?

Post by Dino »

It is my understanding that a little piece is missing an in the works for the IBM, in the meantime, this is the workaround:

viewtopic.php?f=3&t=2356

Basically using a windows IIS as a proxy, with a listener entry that points to the IBM.
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Re: Web API on IBMi - how to call?

Post by Joerg Hamacher »

Hello Dino,

this is unfortunately not good news, that there is obviously still nothing working on the IBMi...
Our customer doesn't want to have an additional Windows server in between.

But we have already programmed years ago about LANSA Integrator and HTTPInbound and HTTPOutbund services on the IBMi and so realized the communication between various systems. The IBMi was also accessed from outside via URL. Is there a different system behind it than with the Web APIs?

And we also managed to access JSON APIs from IBMi that are located on external servers without using an additional server. Out of IBMi works - but not in the other direction?

Would it be possible to use LANSA Integrator's JSONBindFileService to create Web APIs for the IBMi that can be accessed from outside - or would that not work either?

Best regards,
Jörg
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Web API on IBMi - how to call?

Post by Dino »

I wonder myself what is the missing link...

what you define in the API tab regarding paths are registered in the file \LANSA\run\conf\webmodules.conf
which seems to be what is needed by the apache server to find the route to what server module to call.

maybe something related to the exchange of the data back and forth... operations, schemas.
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Re: Web API on IBMi - how to call?

Post by Joerg Hamacher »

Hello,

I have just learned that this functionality shall be delivered with EPC150060. This EPC is expected to be made available sometime in autumn (October).
That would of course be a good thing!

Kind regards,
Jörg
Post Reply