developerforce / Force.com-JavaScript-REST-Toolkit

ForceTK - a minimal Force.com REST API for JavaScript apps
BSD 3-Clause "New" or "Revised" License
315 stars 175 forks source link

Client.apexrest does not pass data param in GET requests #49

Closed mcilroyc closed 9 years ago

mcilroyc commented 10 years ago

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.

metadaddy commented 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"}'
);