Skip to main content
15 events
when toggle format what by license comment
Dec 16, 2017 at 9:42 answer added tiunovs timeline score: 2
Dec 16, 2017 at 4:36 comment added user2086641 @MB34 I know how to create a model to match the Json. Can you please give me an example or an link which help me to input the Json into endpoint with the [FromBody] decorator.
Dec 15, 2017 at 22:39 comment added Malte R What are you sending the request from? a webbrowser?
Dec 15, 2017 at 22:38 comment added Malte R This is invalid json and you are sending it as an url query, which requires it to be url encoded and then url decoded. You should use a post request instead, and send it as the request body instead.
Dec 15, 2017 at 22:17 comment added Ezin82 To test your api take a look to postman or fiddler
Dec 15, 2017 at 22:11 comment added user47589 FYI, I removed the visual-studio tag. Per the tag description, that tag should only be used when your question is about Visual Studio.
Dec 15, 2017 at 22:08 history edited user47589
edited tags
Dec 15, 2017 at 21:54 comment added MB34 The POST is sent FROM the WPF application and the method decoration in the WebApi function should be only [HttpPost]. Also, you should remove the event and producerid from your route and place them in the model: [Route("api/events/getevents/")]
Dec 15, 2017 at 21:47 comment added user2086641 @SteveKennedy It is WPF app, does it support post. If so, how to do it.
Dec 15, 2017 at 21:43 comment added user2086641 @BrandonMiller I will try with remove one bracket. May i know how to receive the Json string in api.
Dec 15, 2017 at 21:42 comment added Steve Kennedy Just FYI. At first glance, it looks like you're trying to create a RESTful API. But when you try to pass an entire JSON structure in as part of the makeup of the URL, you break REST. You really want to send a POST request, and have the JSON be that body of that request.
Dec 15, 2017 at 21:34 comment added MB34 You should create a model to match the JSON, Then use it as input into the endpoint with the [FromBody] decorator. Then it will come into the function in JSON and you can Deserialize to the model.
Dec 15, 2017 at 21:29 comment added Brandon Miller This may not be the answer, I'm not sure.. But it looks like you're sending an object within an object. Your JSON has two opening and two closing brackets. Try removing one from each and maybe that will help?
Dec 15, 2017 at 21:27 comment added Mrg Gek How about to remove one bracket?
Dec 15, 2017 at 21:24 history asked user2086641 CC BY-SA 3.0