1

I am creating a REST Web service in C# and need to take a list of item (e.g. activity list).

How can we take an array as input in Rest Web Service method? What would be final URI that will be created for such method?

3
  • Lalit you have asked five questions, all of which have been answered, but you have not marked any of them as answered. This is why you may not be getting many answers to your questions. Commented Nov 14, 2011 at 9:05
  • Thanks for pointing this... unfortunately except one question none of were answered up to my satisfaction. Commented Nov 14, 2011 at 9:24
  • In that case the answer can be awarded for effort and technical usefulness. For example, the answer provided by @dwightkelly to your question stackoverflow.com/questions/6521573/… shows both effort and is technically useful as it outlines a complete solution. Even if this is not the solution you you ended up following it is the polite thing to do. Commented Nov 14, 2011 at 9:32

1 Answer 1

1

For what I know (I developed ReST services in Java with the Jersey library), the final URI is not affected by the type of the parameters you pass to the service. So the URI would be something like http://asite.com/service/activitylist.

Then for the implementation (in Java, maybe you could try to look for a REST implementation library in C#), in the client I would put my parameters (any type, arrays too) in a Form object (Jersey) and send it with my request. Then in my service I would access my parameters using the annotation @FormParam and finally process them normally in my service.

Hope it helps.

Sign up to request clarification or add additional context in comments.

3 Comments

I want to show the items in the URI and it would be a Get request in my case. Can it be like asite.com/service/activitylist?type=1&type=2?
@Lalit I think the POST sample in this example could give you hints on how to add data to your request: developer.yahoo.com/dotnet/howto-rest_cs.html (I know it's a POST but I think it still is interesting regarding to your question)
It seems that this type of operation i.e. sending list of items in the GET Method, is NOT allowed. It has to be accomplished via POST method only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.