Base solution for your next web application
Open Closed

URL PARAMETERS USING DYNAMIC API METHOD #5263


User avatar
0
dfielec created

Hello,

I'm using Asp.net Zero Core 2 + Angular (last version 5.4.1)

Can i specify the routes using the dynamic api method? I want to use url parameters.

To better explain i have the following:

foo/create foo/edit foo/action1 foo/action2 foo/action3

I would like to have it:

foo/create foo/edit foo/action1/{id}/{param1}/{param2}/... foo/action2/{id}/{param1}/{param2}/... foo/action3/{id}/{param1}/{param2}/...

Instead of passing the id and the other parameters through the input object parameter

thanks in advance


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    As far as I know, dynamic api has no custom routing features for the time being. If you want to use url to pass parameters, you can change the parameters of the application layer method from object to multiple simple parameters.

    Such as:

    Task Create(CreateInput input); Task Create(string name, int age);

  • User Avatar
    0
    dfielec created

    Thank you Maliming,

    I have found this in documentation. But I cant find the "AbpWebApi" or the "DynamicApiControllerBuilder" in the "Modules" of the object "Configuration".

    I have also found this Microsoft article but not "config.MapHttpAttributeRoutes()"

    Please help

  • User Avatar
    0
    maliming created
    Support Team

    AbpWebApi and DynamicApiControllerBuilder and MapHttpAttributeRoutes only exist in the net framework mvc. if you are using the net core there are relevant documents:[http://aspnetboilerplate.com/Pages/Documents/AspNet-Core#controllers])

    But MapHttpAttributeRoutes does not achieve your purpose. As i know currently ABP's dynamic API has not been able to customize routes.