UStAEnts / uems-hub

A hub project containing all microservices and frontend files for Union Event Management System (uems)
2 stars 0 forks source link

API Content Negotiation #41

Open Lan2u opened 4 years ago

Lan2u commented 4 years ago

Is your feature request related to a problem? Please describe. The API will currently always return JSON, we should allow for the ability to return multiple formats.

Describe the solution you'd like The return format could either be specified directly in the path like {API_URL}/{FORMAT} e.g. /events/{id}/json, /events/{id}/xml or the formats that the client accepts could be included using an AcceptsHeader and then the server chooses the 'best' one.

Describe alternatives you've considered See above

Additional context https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-implementation#support-content-negotiation

Vitineth commented 4 years ago

I would lean towards using the Headers option as it is more natural via HTTP and ensures that the api endpoints are kept as clean as possible

Lan2u commented 4 years ago

I would lean towards using the Headers option as it is more natural via HTTP and ensures that the api endpoints are kept as clean as possible

Agree