I have the following web api method in my controller
public HttpResponseMessage PostUpdateCardStatus(CardholderRequest cardholderRequest)
{
var cardId = cardholderRequest.CardId;
switch (cardholderRequest.Action)
{
case "Enable":
break;
case "Disable":
break;
}
var cardholderResponse = new CardholderResponse(cardholderRequest.RequestId)
{
Status = "OK"
};
var response = Request.CreateResponse<CardholderResponse>(HttpStatusCode.OK, cardholderResponse);
return response;
}
This is how I'm calling it from a .NET console app
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:55208/");
var request = new CardholderRequest()
{
RequestId = Guid.NewGuid().ToString(),
CardId = "123456",
Action = "Enable",
LoginId = "tester",
Password = "tester",
};
var response = client.PostAsJsonAsync("api/cardholders", request).Result;
if (response.IsSuccessStatusCode)
{
var cardholderResponse = response.Content.ReadAsAsync<CardholderResponse>().Result;
}
How is it possible to make the same call using VBScript?
I tried googling but I haven't come across any solid examples of calling web api methods from VB script.
Does my web api method support calls from VBScript? Or would I need some tweaking?