Best Practices to follow while writing REST WS :
Form encoding while making POST requests : When you make a POST request, you have to encode the data that forms the body of the request in some way.
HTML forms provide three methods of encoding.
multipart/form-data if the request contains a File upload and it should be used in combination with the INPUT element, type=”file”.
application/x-www-form-urlencoded otherwise, which is the default if you omit enctype header in the request.
NEVER use text/plain as it only used if you want to debug the payload you are sending as part of HTTP request.
URL Encode Query params : When sending requests to REST API from POSTMAN, make sure you URL-Encode the query parameters part of the request.
CORS : Cross origin Resource Sharing : (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
When a request is made from browser to fetch data from an API, Origin header is always sent along with the request. Origin denotes the source of the request. This origin is parsed and verified at API to determine if it can respond with data.
For Http requests that can cause side effects on server data like PUT, DELETE, browser sends an OPTIONS request(Preflight request) before sending the actual request. When API gets the OPTIONS request, it then responds with details like allowed methods, allowed headers, etc – only then browser makes the actual PUT/DELETE requests to API.
Support infinite scrolling via REST API : https://developer.twitter.com/en/docs/tweets/timelines/guides/working-with-timelines