Hello All,
Please guide me - I am again stuck up in Web API Issue.
I have got a Web API with PUT Method.
I need to execute this API and update the database accordingly.
Here the ID is 48521256.
PLeae guide
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Riddhi ValechaPosted Apr 21, 2020, 2:07 PM
Riddhi ValechaPosted Apr 21, 2020, 1:10 PM
Riddhi ValechaPosted Apr 21, 2020, 3:14 AM
Riddhi ValechaPosted Apr 20, 2020, 8:32 AM
{
private static string strURL ="http://10.10.10.10:80/AssetMgmgt/amq/amPortFolio/lportfolioID/4567890";
string resultset = "";
string postdata = "";
if(strURL != "")
{
WebRequest requestobjPost = WebRequest.Create(strURL);
requestobjPost.Method = "POST";
requestobjPost.ContentType = "application/json";
requestobjPost.Credentials = new NEtworkCredentials("user","pwd");
postdata = "
using(var StreamReader = new StreamReader(requestobjPost.GetRequestStream()))
{
StreamReader.Write(postdata);
StreamReader.Flush();
StreamReader.Close();
var HttpResponse = requestobjPost.GetResponse();
using(var StreamReader = new StreamReader(requestobjPost.GetRequestStream()))
{
resultset = StreamReader.ReadToEnd();
}
}
}
}
Riddhi ValechaPosted Apr 15, 2020, 1:24 AM
----------
public String CreateSOAP_UpdateAPI_Put(string ID)
{
string strURL = "";
string result = "";
try
{
strURL = UpdateAPI_PUT + ID;
strURL = string.Format(strURL.Trim());
if(strURL != "")
{
WebRequest requestPost = new WebRequest.Create(strURL);
requestPost.Method = "GET";
requestPost.ContentType = "application/json";
requestPost.Credentials = new NetworkCredentials("user","pwd");
var httpresponse = requestPost.GetResponse();
using(var StreamReader = new StreamReader(httpresponse.GetResponseStream()))
{
result = StreamReader.ReadToEnd();
}
}
}
catch(Exception err)
{
return null;
}
}
------------
Button_Click
protected void button1_click(object sender , EventArgs e)
{
CreateSOAP_UpdateAPI_Put("784525");
}
Riddhi ValechaPosted Mar 30, 2020, 11:52 AM
Riddhi ValechaPosted Mar 26, 2020, 2:39 AM
Riddhi ValechaPosted Mar 25, 2020, 3:55 PM
Vinay SinghPosted Mar 25, 2020, 8:41 AM