× 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.



Rob,
To further clarify what Nadir just wrote about using POST, the HTTP specifications for methods says that POST can be used to "provide a block of data, such as the result of submitting a form, to a data-handling process".

That data handling process does not have to update anything.
REST is an architectural style.  It is not a standard.  The REST style specification refers to the HTTP methods standards.

Close to 100% of "REST" apis do not completely conform to the architectural constraints.  (Technically even JSON does not completely conform.) 

Rather, APIs are said to be RESTful when using most of the architectural constraints.
Some developers have adapted REST as an arbitrary standard, yet many of those developers show non-conforming examples.
Anyone that says that using POST when querying is against any standard (or even style) should do some additional research.
Greg Alston


On Tuesday, December 15, 2020, 6:10:07 PM GMT-3, Nadir Amra <amra@xxxxxxxxxx> wrote:

Rob,

It is not a restriction in IWS.  You can return data using a  POST.
Nothing wrong with that.

If you are asking why you need to use POST, it is because HTTP GET does
not have a payload (other than HTTP headers and query string data).
Because you have parameters that are not being inserted from some input
source (like query string data),  then it is assumed that the data has to
be in the payload.

When  creating APIs, it is good to develop them so that they are
consistent with industry best practices.  And normally POST is used to
create a resource and PUT is used to update.

Remember the point of the URI is to identify a resource, and if this array
of values is data that is needed to identify a resource then the URI is a
good place for this. If on the other hand this array of data forms part of
the new representation that is being submitted in this POST/PUT request,
then it belongs in the request body.

So I think using POST in  your scenario fits the "new representation".

But you can do what you want, and following best practices allow users to
easily use your APIs.

I  hope this answers your question.

"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 12/15/2020 02:43:51
PM:

From: Robert Rogerson <rogersonra@xxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 12/15/2020 02:44 PM
Subject: [EXTERNAL] Re: [WEB400] IWS and input parameters...
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

@Jon, so you are suggesting the pFilterDs input parm(s) be passed as a
character string and then parse them in the RPG.  That way I could still
use a GET.
That may work...

@Nadir, thanks for the links.  I reread them and I think I have a better
understanding.  One question, which I know I'm going to be asked is, why
are you using a POST to retrieve data?  I now understand I can do this.
But is the reason that there is a restriction in IWS (as there is more
than
one parameter that is a structure) or is this a restriction of all web
service servers?

Thanks,

Rob

On Tue, Dec 15, 2020 at 11:09 AM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:

I don't have time to play but, if you want to stick with GET, can you
not
add an extra simple input parm to deal with this?


Jon


On Dec 14, 2020, at 11:20 PM, Robert Rogerson <rogersonra@xxxxxxxxx>
wrote:

I'm new to this so I'm trying to understand.
If I want to return rows, normally I would use a GET.  But since one
of
my
input parameters is a structure I'm forced to either use a POST or a
PUT.
So I'm sort of forced out of the convention that GET is to read
records,
POST is to create records and PUT is to update records.
So it's ok to do a POST only to read records?

Is there anyone else using IWS from an RPG perspective that has
found or
could share some useful information?

Thanks,

Rob

On Mon, Dec 14, 2020 at 10:37 PM Nadir Amra <amra@xxxxxxxxxx> wrote:

the suffix _LENGTH must be  capital because that  is what  IWS
currently
looks for.  It should not matter because it is not part  of
payload.

If you have a structure that is an input parameters, then the  HTTP
method
is POST  or PUT.

Other  than  what we have  for  doc on  web site,  and  articles,
that
is
all the doc there  is.  We are in  process of updating the  doc.




"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 12/14/2020
05:52:33
PM:

From: Robert Rogerson <rogersonra@xxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 12/14/2020 05:52 PM
Subject: [EXTERNAL] Re: [WEB400] IWS and input parameters...
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

@Nadir, your assumption is correct, pFilterDs is indeed input.  So
you
are
saying that I can have a data structure as input?

Why must the "_lenght" be in upper case.  I've never seen nor
understand
this requirement.

Thanks,

Rob

On Mon, Dec 14, 2020 at 3:25 PM Nadir Amra <amra@xxxxxxxxxx>
wrote:

Which  parameters are  input  and  which output?

And  "_length" suffix  should  be  "_LENGTH"

Assuming  pFilterDs is  input,  you may  want  to  define a
length
field
for it as well so that  you  know  how many  entries  are being
passed
in.


"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 12/14/2020
08:24:21
AM:

From: Robert Rogerson <rogersonra@xxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 12/14/2020 08:24 AM
Subject: [EXTERNAL] [WEB400] IWS and input parameters...
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

I want to have a filter(s) for my api.
An individual filter is defined as

dcl-ds filterTmp template qualified;
  type char(20);
  value char(20);
end-ds;

But there may be multiple occurrences of filter.  For example,

'Warehouse': '95,96,97'
'Type':'Shipments'
'DateRange': 'LastWeek'

I was hoping to do something like
dcl-pi *n;
  pFilterDs likeds(filterTmp) dim(10) const;
  transactionDs_length int(10);
  transactionsDs likeds(transactionsTmp) dim(1000);
  httpStatus like(httpStatusTmp);
  httpHeaders like(httpHeadersTmp) dim(10);
end-pi;

But when I try this on Step 5 of 9 on the Deploy New Service
Wizard
I
get
error
*Error:* ZUI_54411: The HTTP method must be PUT or POST when
there
is an
input parameter that is not being injected with a value.

How should I be doing this?







As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.