Answer the question
In order to leave comments, you need to log in
Is it possible in REST services to send a request to the server as a JSON document?
How to send a request to get a document to a service in a REST service?
It is clear that I can parse my document into pieces for a GET request and send it
to /query/?field1=1&field2=2&field3['fdgfd']=3
But, it would be much nicer to work with the request if I worked with it as a document
{
field1:1,
field2:2,
field3: {
'fdgfd':3
}
}
Answer the question
In order to leave comments, you need to log in
/api/v1/some_resources?json=%7B%0Afield1%3A1%2C%0Afield2%3A2%2C%0Afield3%3A%20%7B%0A%27fdgfd%27%3A3%0A%7D%0A%7D
var data = { field1: 1, field2: 2, field 3: { fdgfd: 3 } };
varxhr = new XMLHttpRequest();
xhr.open('POST', '/api/method', true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.send(json.stringify(data));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question