Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Help with Web API - getting POST content

$
0
0

So I have created a controller class to get the content of an HTTP post.  The method is as follows:

' POST api/<controller>
Public Sub PostValue(<FromBody()> ByVal value As String)

     'code logic go here...

End Sub

When I code to read the 'value' parameter within the function above, for the post content, it's always an empty string.  As for testing, I have used curl to do a post, and it looks as follows:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://localhost:52043/api/test --data json="{'parameter': [{'name':'Name', 'value':'123'}]}"

What have I done wrong here?  Please help.  Thanks!


Viewing all articles
Browse latest Browse all 4850


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>