hi..
How to send Json Data to Web API using Post Request.
My Json value is like below.
var json123 = {
"firstname": {
"value": "john",
"versions": [
{
"value": "john",
"selected": false
},
"lastname": {
"value": "paul",
"versions": [
{
"value": "paul",
"selected": false
},
"email": {
"value": "[email protected]",
"versions": [
{
"value": "[email protected]",
"selected": false
},
}
Here I need to pass all data to my post request and after receiving the request i need to take the each attribute value through c# only.
How to do this..
need ur suggestions with examples.
Regards,
Gopal.s
Loading
Jaganathan BantheswaranPosted Dec 18, 2013, 4:49 AM
gopal kannanPosted Dec 18, 2013, 4:02 AM
Jaganathan BantheswaranPosted Dec 18, 2013, 3:54 AM
try,
data: JSON.stringify(json123).
gopal kannanPosted Dec 18, 2013, 3:32 AM
Thax for your reply.
"firstname": {
"value": "john",
"versions": [
{
"value": "john",
"selected": false
},
"lastname": {
"value": "paul",
"versions": [
{
"value": "paul",
"selected": false
},
"email": {
"value": "john@gmail.com",
"versions": [
{
"value": "john@gmail.com",
"selected": false
},
}
insertData(json123);
}
Here i have used the following post code.
But none of them are worked.
}
But i need to pass the whole data into my post rest service. after receiving the values from the api then only i need to take the column value using c#.
Here what i am missing.
How to achieve this.
Regards,
Gopal.s
Jignesh TrivediPosted Dec 18, 2013, 3:06 AM
hi,
please refer below link it might help you
http://www.codeproject.com/Tips/678138/MVC-using-Web-API-and-JQuery-to-GET-or-POST-Data
http://encosia.com/using-jquery-to-post-frombody-parameters-to-web-api/
http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api
Jaganathan BantheswaranPosted Dec 18, 2013, 2:54 AM
Where you feel difficult, on Post request or Post Action method?