Closed mcilroyc closed 9 years ago
Note that you can now send string or object payload for GET, POST, etc, so all of these work:
// GET with Object payload
client.apexrest('/myservice',
function (response) {...},
function (jqXHR, textStatus, errorThrown){...},
'GET',
{name : 'Burlington'}
);
// GET with String payload
client.apexrest('/myservice',
function (response) {...},
function (jqXHR, textStatus, errorThrown){...},
'GET',
'name=Burlington'
);
// POST with Object payload
client.apexrest('/myservice',
function (response) {...},
function (jqXHR, textStatus, errorThrown){...},
'POST',
{name : 'Burlington'}
);
// POST with String payload
client.apexrest('/myservice',
function (response) {...},
function (jqXHR, textStatus, errorThrown){...},
'POST',
'{"name" : "Burlington"}'
);
If method=GET, I would expect the data object to be serialized on to the GET request, but the "processData=false" flag sent to the underlying ajax method is preventing that
https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit/blob/master/forcetk.js#L274
There should be some way to allow apexrest to handle GET requests with querystring data. This would be useful or custom apexrest services.