…API/emailMessage/?emailId=test123
I have written the above URL using Web API to get the email in JSON data format(email body, sender, CC, To, etc).
Also, I have the requirement to allow download of email along with attachment for the same URL.
One way to do it is using content negotiation. I can use “MediaTypeHeaderValue("application/octet-stream")” to send the content as downloadable.
Question is…. 1. Which parameter in the GET request the user should request for JSON content or download of content? Or what is the correct way of asking the content type from HTTP client? 2. On the server side I can read what content type the user is asking and send the appropriate data just using case statement. Is there anything to be considered on the server side in this scenarios?
Thank you, Eric