Although the optimal and most common way is to send JSON data to a REST
API, there are cases when you need to use existing systems to POST and
PUT data. These can send a common HTTP form like
"value1=data1&data2=value2"
Check if the submitted data is in JSON format. If it is not, try to use
querystring.parse(requestData) to convert the requestData to JSON
format. If this does not work either, send the error message to the
client.
Although the optimal and most common way is to send JSON data to a REST API, there are cases when you need to use existing systems to POST and PUT data. These can send a common HTTP form like "value1=data1&data2=value2"
Check if the submitted data is in JSON format. If it is not, try to use querystring.parse(requestData) to convert the requestData to JSON format. If this does not work either, send the error message to the client.