2015 Sep 20 9:07 PM
Hi,
sorry but I am a very novice in API rest.
I created a service that handle my Zclass that implement the interface IF_HTTP_EXTENSION and so the method HANDLE_REQUEST.
When my service is called with a method GET, some parameters are passed into the url. For example
http://my_address.net:8000/my_folder/get_something?sap-client=100¶m1=12345678
I want to retrieve the value of parameter "param1"
I tried using the method "server->request->get_uri_parameter" passing the name "param1" but no values return. I tried with some others methods but nothing. I can see that anything happen in debug...
How can i retrieve the parameter, or better, the list of parameters passed?
Thanks a lot
KR
Massimo
2015 Sep 21 2:50 PM
Hi Custodio,
thanks a lot for your fast reply.
Actually I had already tried the method server->request->get_form_fields() but the only parameter name that I have is "content", there is no "param1"... maybe they are passing me the parameters in a wrong way?
However Lucas thanks a lot for the link, it's always good have resources to improve my knowledge...
2015 Sep 20 10:14 PM
Check out this blog: - someone has already done exactly what you're trying to do. The code is available on github: cesar-sap/abap_fm_json · GitHub
2015 Sep 21 2:06 AM
Hi Lucas,
Although this is a very nice and well known project, and don't think this is "exactly" what Massimo needs.
Hi Massimo,
Please try method server->request->get_form_fields( ), for all parameters, or server->request->get_form_field( ) for a single parameter. Yes, I know, its name is misleading, but should solve your problem.
Another way is to use server->request->get_header_field( '~request_uri' ) and then split the values manually. First method would be easier though.
Cheers,
Custodio
2015 Sep 21 5:15 AM
Haha well... He would have found his answer by reading that code.... I wasn't suggesting he use the project in its entirety.
2015 Sep 21 2:50 PM
Hi Custodio,
thanks a lot for your fast reply.
Actually I had already tried the method server->request->get_form_fields() but the only parameter name that I have is "content", there is no "param1"... maybe they are passing me the parameters in a wrong way?
However Lucas thanks a lot for the link, it's always good have resources to improve my knowledge...
2015 Sep 22 4:45 AM
If the HTTP method is GET, surely you will have on the fields parameter everything after "?", in a name/value table.
Maybe they are using POST?
Cheers,
Custodio
2015 Sep 22 5:15 PM
Hi Custodio,
your images let me speechless...
I'll speak with "the others".
Thanks a lot.
KR
Massimo