Why not use content negotiation to return JSON object?

tombola

I'm using content negotiation to return a JSON object from some WebAPI controllers.

I found this question How to return Json object on Web API Controller

Here some of the people answered seem to agree that you shouldn't rely on negotiation but should create a new HttpContent class for the JSON return.

Why is this please? As a beginner content negotiation seems to work well.

I have searched for this answer, but can't find an explanation.

ssilas777

ASP.Net Web API in its purest form is intented to create REST ful web services.

As per REST full standards client should have the ability to decide whether the response should be in XML/JSON response. And this can be achieved using Content-negotiation header in the request.

That means your understanding is correct and using Content negotiation you can decide whether you require XML/JSON response in ASP.Net Web API.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Content negotiation to return HTML

From Dev

How to Use Content Negotiation in Spring Data Rest?

From Dev

How to Use Content Negotiation in Spring Data Rest?

From Dev

Why would HTTP content negotiation be preferred to explicit parameters in an API scenario?

From Dev

PhalconPHP: content negotiation?

From Dev

Restlet Content Type Negotiation

From Dev

Content negotiation using WebSharper

From Dev

PhalconPHP: content negotiation?

From Dev

Spring boot controller content negotiation

From Dev

Jersey - content negotiation for error handling

From Dev

Why does play.libs.Json.toJson return an empty object?

From Dev

Why does JSON.stringify on TypeError return an empty object

From Dev

why it is displaying object object not content?

From Dev

Access content of JSON object

From Dev

Why does the variable used in the [For.. in] loop return different values when the object is a JSON object vs an Array object?

From Dev

return data in a json object

From Dev

Return JSON object problems

From Dev

JSON Object return undefined?

From Dev

Return file in json content format

From Dev

Why Mongoid::Criteria could use the object's as_json?

From Dev

Spring MVC Content Negotiation throwing ClassCastException

From Dev

SupportedMediaTypes not used when doing content negotiation

From Dev

How to disable content negotiation for Spring Actuators?

From Dev

Content Negotiation when looking at different output formats

From Dev

Content negotiation for File Download In Web API

From Dev

Is there a simple way to solve content negotiation in Spring boot

From Dev

Content negotiation not working with respond_to stanza

From Dev

What is performing Transparent Content Negotiation in Apache

From Dev

Why does JSON.stringify return empty object notation "{}" for an object that seems to have properties?

Related Related

  1. 1

    Content negotiation to return HTML

  2. 2

    How to Use Content Negotiation in Spring Data Rest?

  3. 3

    How to Use Content Negotiation in Spring Data Rest?

  4. 4

    Why would HTTP content negotiation be preferred to explicit parameters in an API scenario?

  5. 5

    PhalconPHP: content negotiation?

  6. 6

    Restlet Content Type Negotiation

  7. 7

    Content negotiation using WebSharper

  8. 8

    PhalconPHP: content negotiation?

  9. 9

    Spring boot controller content negotiation

  10. 10

    Jersey - content negotiation for error handling

  11. 11

    Why does play.libs.Json.toJson return an empty object?

  12. 12

    Why does JSON.stringify on TypeError return an empty object

  13. 13

    why it is displaying object object not content?

  14. 14

    Access content of JSON object

  15. 15

    Why does the variable used in the [For.. in] loop return different values when the object is a JSON object vs an Array object?

  16. 16

    return data in a json object

  17. 17

    Return JSON object problems

  18. 18

    JSON Object return undefined?

  19. 19

    Return file in json content format

  20. 20

    Why Mongoid::Criteria could use the object's as_json?

  21. 21

    Spring MVC Content Negotiation throwing ClassCastException

  22. 22

    SupportedMediaTypes not used when doing content negotiation

  23. 23

    How to disable content negotiation for Spring Actuators?

  24. 24

    Content Negotiation when looking at different output formats

  25. 25

    Content negotiation for File Download In Web API

  26. 26

    Is there a simple way to solve content negotiation in Spring boot

  27. 27

    Content negotiation not working with respond_to stanza

  28. 28

    What is performing Transparent Content Negotiation in Apache

  29. 29

    Why does JSON.stringify return empty object notation "{}" for an object that seems to have properties?

HotTag

Archive