function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
REST API and JavaScritpsREST API and JavaScritps 

REST API and JavaScript

How can I list of the leads' table using REST API in javascript, no using java o .net? I need it using in full javascript.

I have the keys.

 

I listened suggestions. 

 

 

gwestrgwestr

Based on what you described, I think you want to do a query like this:

 

/services/data/v20.0/query?q=SELECT+id,name+FROM+lead

 

And then parse the results in Javascript.  You can use eval(jsonResponse) in Javascript or a library to start accessing the results, stored in an array called "records".  Here is what it might look like:

 

HTTP/1.1 200 OK

Server:

Content-Type: application/json; charset=UTF-8

Transfer-Encoding: chunked Date: Mon, 01 Nov 2010 19:25:01 GMT
{ "totalSize" : 589, "done" : true, "records" : [ { "attributes" : { "type" : "Lead", "url" : "/services/data/v20.0/sobjects/Lead/XXXXXXXXXXXXXXX" }, "Id" : "XXXXXXXXXXXXXXX", "Name" : "John Doe" },

 

...