I want to call REST Api from Asp.net application in order to integrate with NCB bank, they provide me with some test parameters like:
- AccessCode
- Merchant Id
- Secure Hash code
I've tried the below code but it doesn't work properly it throw 404 http error code.
private const string URL="https://migs.mastercard.com.au/vpcpay";
private const string urlParameters = @"{""object"":{""vpc_AccessCode"":""000000"",""vpc_Version"":""0""};}";
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(URL);
//Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync(urlParameters).Result;
if (response.IsSuccessStatusCode)
{
// Parse the response body. Blocking!
var dataObjects = response.Content.ReadAsAsync<IEnumerable<DataObject>>().Result;
foreach (var d in dataObjects)
{
Console.WriteLine("{0}", d.Name);
}
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}