none
Ask web api with several parameters using c# RRS feed

  • Question

  • Hi,

    I want to ask a get function in web api, with more than one criteria.
    I have this code in my shared universal app.

    HttpClient test2 = new HttpClient();
    string res2 = await test2.GetStringAsync(new Uri("http://localhost:56208/api/test/5"));
    txtMyText.Text = res2;

    I have this code in a web api contract.

    public string Get(string id)
            {
                return "Magnus value: "+id ;
            }

    Now I want to send two parameters to the get function:

    public string Get(string id, string name)
            {
                return name+" value: "+id ;
            }

    How do I accomplish that on the client side. Is the get function correct when using two in parameters?

    BR /Magnus

    Thursday, August 14, 2014 8:27 AM

Answers

  • Hi,

    This forum is used to discuss the question about the WCF, then for your question it will be better for you to post it in the Web API forum, then you will get good replies from the Web API experts.

    #Web API Forum:
    http://forums.asp.net/1246.aspx/1?Web+API .

    Thanks for your understanding.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 15, 2014 4:40 AM
    Moderator

All replies

  • Hi,

    This forum is used to discuss the question about the WCF, then for your question it will be better for you to post it in the Web API forum, then you will get good replies from the Web API experts.

    #Web API Forum:
    http://forums.asp.net/1246.aspx/1?Web+API .

    Thanks for your understanding.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 15, 2014 4:40 AM
    Moderator
  • Hi,

    I realized that going to msdn and forums doesn't bring up forums about asp.net, since they are located in another area, which is a Little bit confusing, but now I know how to find it. Thank you.

    BR /Magnus

    Friday, August 15, 2014 7:30 AM