lundi 24 août 2020

Web API Post Method in Body gives null in Postman

I have Web Api where I have a complex type as parameter. I am passing the parameter in Json format in the Body, but it is always giving error. I tried so many solutions found in google, but nothing worked out.

I have declared a class as below:

public class MyEntities
{        
    public string id { get; set; }
    public string created_at { get; set; }

    [JsonProperty("event")]
    public string eventdesc { get; set; }
   
}

and I am calling the class in the Controller method as follows:

public HttpResponseMessage DebitPayLoad(MyEntities inps)
    {
                 .......
    }

And in Postman

curl --location --request POST 'http://localhost:44354/api/DebitPayLoads' \


{   
"MyEntities":
{         
    ​"id": "WHN190207164356040UZO12FC2U3F123",   
    "created_at ": "test",
    "event" : "nach.debit.success"
    
}

}

I have an overridden method of OnAuthorization in order to verify a checksum value. I was under the impression that the value is getting null because of this, but when I commented the same and tried, the result was same.

I tried many solutions found in google, but nothing worked out. Any possible fixes?




Aucun commentaire:

Enregistrer un commentaire