Reputation: 657
Is it typical or the preferred method to have JSON data embedded in a POST request? For example, if I have maybe five attributes that I want to send, should I embed it in the url or stuff it in the body of a POST request?
So it would be:
www.example.com?attr1=x&attr2=y&attr3=z....
versus in the body of the POST:
{
"attr1": x,
"attr2": y,
"attr2": z
}
I am just wondering which is the standard or best practice way.
Upvotes: 0
Views: 299
Reputation: 1634
I think it depends of the situation. If the parameters you pass are short and you don't mind having them exposed in the browser address bar, the get method is all right. On the other side, if your parameters are lengthy you should consider the post method.
"Get" method have a limitation on size depending of the browser you're using (cf.http://www.boutell.com/newfaq/misc/urllength.html) . "Post" method size limitation is a server side settings.
Upvotes: 1