How to structure an API where the same data can be requested in a different format, in the RESTful format. For instance.
GET /person/<id>
Now, depending on the requirements of the client (browser), the data can be sent as html (say, normal rendering) or Json (for example, an ajax call). Therefore, my doubts:
- Can I keep the same URL for both requests or leave them separately?
- How to determine if a request for html / Json is on the server. The request type is the same (GET). So which parameter should I consider.
- How to determine the difference in the data type of the client (html / Json) \
thank,
BSR.
source
share