Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to send parameter in REST api in xamarin.forms ?

$
0
0

How to send parameter in REST api in xamarin.forms ?

I have created REST API Project in xamarin using PCL.

When I call Simple REST api using Below code in Xamarin.forms (Portable Class Library) then I have Successfully receive json Response.

using (var cl = new HttpClient())
{
    var result = await cl.GetStringAsync("http://192.168.1.100/apps/jara/web/api/user/test");
    jsonResponseClass des = JsonConvert.DeserializeObject<jsonResponseClass>(result);
    lbl1.Text = des.code + " " + des.status + " " + des.message;
}

public class jsonResponseClass
{
    public string code { get; set; }
    public string status { get; set; }
    public string message { get; set; }
}

Using above code I got a response

{
code: 200,
status: "ok",
message: "hello"
}

REST API response type is JSON and type is POST

Now, I want to call below Login Api using paramater.

http://192.168.1.100/apps/jara/web/api/user/login

Paramater : email_id and Password

this api success response type is....

{
code: 200,
status: "Success",
User: {
userid: 126,
token: "d154s4d54s654df5s4df56s4df564s5df4",
email: "shahbuddin@gmail.com",
mobile_number: "9898989898"
},

message: "Successfully logged in"
}

What can i do ?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>