× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



But that approach do not follow the REST API standards, as per REST
standards
(POST) /students - Creates new student
(GET) /students - Returns all students
(GET) /students/123 - Return student 123
(PUT) /students/123 - Update student 123

Rajesh

On Tue, Nov 17, 2020 at 4:19 PM Nadir Amra <amra@xxxxxxxxxx> wrote:

Just to clarify,using Kelly's method does not require URL to change. GET
requests will be passed to "procedure" configured to handle GET request,
and POST request will be handled by "procedure" configured to handle POST
request. So the solution is viable.




"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 11/17/2020 02:08:02
PM:

From: Kelly Cookson <KCookson@xxxxxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 11/17/2020 02:08 PM
Subject: Re: [WEB400] [EXTERNAL] Re: Mixing sql and service program in
IWS...
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

I should have clarified: this is not exactly what you requested,
since you will need to add the method names to the URL. I think what
you requested was a way to use a single URL, but have different code
executed within the REST service based on the HTTP used to request
something from the REST service. So https://
urldefense.proofpoint.com/v2/url?
u=http-3A__myUrl_students&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=1i-
jGlz0-JTK1aLHcsU-


ew&m=doQxAJm1StlIyyoIoGHH85gQEl1p6AlIcbMGY0ju1IY&s=50EfhLLBwIw0qFLR8A5I20Gn8_FDfzVqEuFdaE7_0fw&e=
would execute a SQL statement when it receives a GET request but
call a program when it receives a POST request.

What I was suggesting would require another element in the URL to
identify the method of the IWS service. So:
(1.) INVALID URI REMOVED


u=http-3A__myUrl_students_enrolledStudent-3Fclass-3DPSYC101&d=DwICAg&c=jf_iaSHvJObTbx-
siA1ZOg&r=1i-jGlz0-JTK1aLHcsU-


ew&m=doQxAJm1StlIyyoIoGHH85gQEl1p6AlIcbMGY0ju1IY&s=v5EObqr7AiZDLVWmgaDBz0oyL-
wkhK4bNkg8pP4pz7o&e= would execute the SQL statement with a
parameter to return students enrolled in Psychology 101.
(2.) INVALID URI REMOVED


u=http-3A__myUrl_students_enrollNewStudent-3Fclass-3DPsyc101-26studentId-3D12345&d=DwICAg&c=jf_iaSHvJObTbx-
siA1ZOg&r=1i-jGlz0-JTK1aLHcsU-

ew&m=doQxAJm1StlIyyoIoGHH85gQEl1p6AlIcbMGY0ju1IY&s=cmCrGEIHwVg2q66NqOJVGm-
x9j2D01qvvPUCZLS_4_A&e= . would call the stored procedure, which
would in turn call the desired ILE program to enroll a new student
into the Psychology 101 class.


Thanks,

Kelly Cookson
Senior Software Engineer II
Dot Foods, Inc.
1-217-773-4486 ext. 12676
www.dotfoods.com


-----Original Message-----
From: Kelly Cookson
Sent: Tuesday, November 17, 2020 1:56 PM
To: Web Enabling the IBM i (AS/400 and iSeries)
<web400@xxxxxxxxxxxxxxxxxx>
Subject: RE: [EXTERNAL] Re: [WEB400] Mixing sql and service program in
IWS...

Just throwing this out as a possibility...I have never done this and
have no clue about performance, limitations, or complexity in
troubleshooting.

Would it be possible to create a *stored procedure* that calls the
desired ILE program? I know stored procedures can call ILE programs.
I've seen other people do it in our shop.

Then, use IWS to create a single REST service (SQL type service).
The REST service would contain two methods within it.
(1.) One method receives HTTP GET requests and executes the SQL
statement against the database file or table (e.g., SELECT * FROM
MYFILE).
(2.) A second method receives HTTP POST requests and executes a SQL
CALL statement to call the stored procedure--which in turn calls the
desired ILE program.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: INVALID URI REMOVED


u=https-3A__lists.midrange.com_mailman_listinfo_web400&d=DwICAg&c=jf_iaSHvJObTbx-
siA1ZOg&r=1i-jGlz0-JTK1aLHcsU-


ew&m=doQxAJm1StlIyyoIoGHH85gQEl1p6AlIcbMGY0ju1IY&s=SPa5Qp0rwuc7iSSZqe6RedXEsDhZR1TEPX6G4x1bacw&e=
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at INVALID URI REMOVED
u=https-3A__archive.midrange.com_web400&d=DwICAg&c=jf_iaSHvJObTbx-
siA1ZOg&r=1i-jGlz0-JTK1aLHcsU-
ew&m=doQxAJm1StlIyyoIoGHH85gQEl1p6AlIcbMGY0ju1IY&s=B_EBzWZdB1YMJ-
ql3ytUqVFMoHSQseHIMNF_SROlOKU&e= .



--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.