Hi all,
is it possible to define an endpoint dynamically in:
class : CL_REST_ROUTER
method: ATTACH
importing parameter: IV_TEMPLATE
Explanation:
When I define the interface IF_REST_APPLICATION~GET_ROOT_HANDLER:
method IF_REST_APPLICATION~GET_ROOT_HANDLER. DATA(lo_router) = NEW cl_rest_router( ). lo_router->attach( iv_template = '/DATA' iv_handler_class = 'Z_REST_RESOURCE' ). ro_root_handler = lo_router. endmethod.
I would like to pass the string "/DATA" dynamically, so that if I want it to be called as "MARA" it would be like:
http://domain.com:8000/sap/bc/z_test_srv/MARA
this is because I created a wrapper class for my GET METHOD where I want to pass that "MARA" param dynamically:
METHOD if_rest_resource~get. DATA: LV_JSON TYPE STRING. z_dynamic_table_api=>create_itab_api(EXPORTING iv_itab_name = 'MARA' " ITAB NAME TO FETCH io_response = mo_response<br> IMPORTING ev_json_string = LV_JSON " JSON RESULT ). ENDMETHOD.
Therefore, if I want it to be another table name like "EKKO" the endpoint would be modified and my GET method as well.
Is it possible??