Top "Asp.net-web-api2" questions

ASP.

Web API 2: how to return JSON with camelCased property names, on objects and their sub-objects

UPDATE Thanks for all the answers. I am on a new project and it looks like I've finally got to …

c# .net asp.net-web-api json.net asp.net-web-api2
Swagger UI Web Api documentation Present enums as strings?

Is there a way to display all enums as their string value in swagger instead of their int value? I …

c# asp.net-web-api asp.net-web-api2 swagger-ui swashbuckle
How to return a PDF from a Web API application

I have a Web API project that is running on a server. It is supposed to return PDFs from two …

c# asp.net pdf asp.net-mvc-5 asp.net-web-api2
How do I unit test web api action method when it returns IHttpActionResult?

Let's assume this is my action method public IHttpActionResult Get(int id) { var status = GetSomething(id); if (status) { return Ok(); } …

c# asp.net-web-api asp.net-web-api2
Post byte array to Web API server using HttpClient

I want to post this data to Web API server: public sealed class SomePostRequest { public int Id { get; set; } public …

c# asp.net-web-api asp.net-web-api2 dotnet-httpclient
How to return JSON in an ApiController for a single method?

Currently, my ApiControllers are returning XML as a response, but for a single method, I want to return JSON. i.…

c# asp.net-mvc asp.net-web-api asp.net-web-api2 asp.net-apicontroller
Multiple parameters in a web api 2 get

I want to make a web api that is passed 4 parameters. Here is my route: config.Routes.MapHttpRoute( name: "DefaultApi", …

asp.net-web-api2
How to change default Web API 2 to JSON formatter?

I have a Web API project that returns some product data. It negotiates the return type correctly depending on the …

c# asp.net-web-api asp.net-web-api2
Unable to get request header in asp net core web API

I am trying to create a custom filter in asp net core web api which is as below but unable …

c# asp.net-core asp.net-web-api2
Add a custom response header in ApiController

Until now, I had a GET method that looked like the following: protected override async Task<IHttpActionResult> GetAll(…

c# asp.net asp.net-web-api http-headers asp.net-web-api2