0

i have my own rest API i am calling below code in my c# 3.5 framewok but this method does not call please help me

 var json = JsonConvert.SerializeObject(objproperties);
                string url = "http://localhost:3423";
                using (WebClient client = new WebClient())
                {
                    responseData = client.UploadString(url+"api/json/Cardpayment", json);
                }  

my REST API Method.

    [System.Web.Http.AcceptVerbs("GET", "POST")]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public HttpResponseMessage Cardpayment(classProperties objproperties)
    {
        try
        {
                    string myid = objproperties.myid;
        }
    }
addi khan
  • 17
  • 3
  • 11

1 Answers1

0

Add Header ..its working fine for me..

            client.Headers.Add("API-Version: 5.0");
            client.Headers.Add("Content-Type", "application/json");
      responseData = client.UploadString(url+"api/json/Cardpayment", json);
addi khan
  • 17
  • 3
  • 11