Forum Xamarin.Forms

How to bind or consume the below Web Api to Picker in Xamarin forms cross platform?

DemoCloudDemoCloud Member ✭✭✭

How to consume the below web api in xamarin forms?
Below is the code for web api:
public HttpResponseMessage GetNames()

        //Conectionstrings for different databases
        string client1 = ConfigurationManager.ConnectionStrings["client_db1"].ConnectionString;
        string client2 = ConfigurationManager.ConnectionStrings["client_db2"].ConnectionString;
        string client3 = ConfigurationManager.ConnectionStrings["client_db3"].ConnectionString;

        //Applying the select command for different databases
        SqlConnection con = new SqlConnection(client1);
        SqlDataAdapter da1 = new SqlDataAdapter("select provider_name,Id from Provider_details", con);
        DataSet ds1 = new DataSet();

        con = new SqlConnection(client2);
        da1.SelectCommand.Connection = con;
        DataSet ds2 = new DataSet();

        con = new SqlConnection(client3);
        da1.SelectCommand.Connection = con;
        DataSet ds3 = new DataSet();

        //Merging the database to select the provider name

        //return ds;
        return Request.CreateResponse(HttpStatusCode.OK, ds1);

Please help me


  • jezhjezh Member, Xamarin Team Xamurai

    If we want to communicate with the server, we need to know the request url of the webapi.

    For this, you can consult with the web api developers of your server.

    For how to communicate with different web services, you can check the official document:

    Best Regards!

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • DemoCloudDemoCloud Member ✭✭✭
    edited December 2020

    Hello, The url is shown below,, code for web api is shared, i want to call it in xamarin forms,
    I'm not getting how to call a HttpResponseMessage web api.
    please help

  • jezhjezh Member, Xamarin Team Xamurai

    Have you checked the official document Xamarin.Forms and Web Services?

    This article provides a walkthrough of the Xamarin.Forms sample application that demonstrates how to communicate with different web services. Topics covered include the anatomy of the application, the pages, data model, and invoking web service operations.

    If you read through above document, you should know how to call a HttpResponseMessage web api.

Sign In or Register to comment.