forum

Home / DeveloperSection / Forums / How do I use WebAPI/Rest correctly when other params are needed

How do I use WebAPI/Rest correctly when other params are needed

Anonymous User221405-Dec-2014

I am new to WebAPI and rest and am trying to do things correctly. By default if I were to access something such as User I would call api/user/5 if I wanted user 5. This would go to my User controller to Get(int num) I think. But I know I will often need other params passed as well. Currently I have Get(JObject data), but that data param is for other parameters. I will need other optional params whether I am sending an ID or wanting a list of everything. How do I go about organizing methods properly with WebAPI? Am I misunderstanding something?

 

To clarify: This question is more about REST than dynamic objects, though they play a part:

 

How do I get a single resource vs a list of resources when I need additional params. I see those concepts as two separate methods, but the additional params complicate it in my mind when routing is involved.


Updated on 05-Dec-2014
I am a content writter !

Can you answer this question?


Answer

2 Answers

Liked By