I have a method based on which I bring response as SUCCESS
and FAILURE
. So on SUCCESS
status I want to make an API call which is https://testabc.com/xxxxx/pmp/xxx
Below is that method.
public void IsSiteIPLValidorNot(string NEID, out string response)
{
response = ""; string status = string.Empty;
response = CommonUser.GET_IPL_STATUS_ON_NEID(NEID);
if (response == "SUCCESS")
{
// call api here
}
else
{
ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Site is not IPL');", true);
}
}
Do let me know how can be done in simple and easy way.
EDIT
The details of API is here.
url --location 'https://testabc.com/xxxx/pmp/xxx'
--header 'Content-Type: application/json'
--data '{
"A6_NEID": "INGJJMGRPVTGNB0001PMPAA6001",
"Azimuth": 10,
"Height": 26,
"VerticalBeamwidthTilt": 2,
"VerticalBeamwidth": 30,
"HorizantalBeam": 65,
"DistanceofCone": 500,
"SourceSystem": "MANUAL"
}'
2
Answers
Use HttpClient() class to make an API call. Something like that:
Microsoft has a great documentation about making HTTP requests, but I’ll also provide you an example for your case: