I have a rest API, returns JSON response.
I have to call this rest API from web application.
it's quite easy to develop
But, I want the simplest way to call this rest url.
Url :
billing/customerDetails/{Cid}/billarrangement/{aId}/bill/{bId}/getbillSummary
Method: GET
example URL :
billing/customerDetails/52145879/billarrangement/1234569/bill/9879/getbillSummary?uan=5214789635
What I have tried:
string reqUrl = string.Format("billing/customerDetails/{0}/billarrangement/{1}/bill/{2}getbillSummary?uan={3}", cID, aNo, bId, UAN);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
req.Credentials = CredentialCache.DefaultCredentials;
req.Accept = "text/json";
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
{
if (resp.StatusCode == HttpStatusCode.OK)
{
}
}
I want to know if this one is simplest.
Or if anything wrong, please correct me.
If its not simplest, please help me with that.