Answers for "accept header in api"

2

accept header in api

`Accept Header` can be used to ask the server to return
different type of response format 

For example :  

`/api/xname` endpoint , support both xml and json
as response type so we can add accept header `application/xml` 
to get xml result and `application/json` result. 

If server does not support such type ,
it will return `406`(not acceptable)  status code.
Posted by: Guest on December-06-2020

Browse Popular Code Answers by Language