Web API ResponseType for Single Integer

Viewed 8872

What is the "correct" way to have a call to a Web API REST service that simply returns a single integer?

I have no requirements here in terms of XML, JSON, or anything else. The call to the service just needs to return an integer.

Do I use the ResponseType attribute here?

I have the service return type as HttpResponseMessage, and for services such as something returning JSON I would set the Content property on this to StringContent with UTF8 "application/json".

But what is correct for a single integer?

3 Answers
Related