How to use jsforce to call rest api?

Posted by ExiaHuang on April 6, 2017

How to use jsforce to call rest api?

1
2
3
4
5
6
7
8
9
10
11
12
13
    var _request = {
        url: '/services/data/v37.0/sobjects',
        method: 'get',
        body: '',
        headers : {
                "Content-Type" : "application/json"
            }
    };
    console.log(_request);

    conn.request(_request, function(err, resp) {
        console.log(resp);
    });

The URL for a namespaced classes contains the namespace. For example, if your class is in namespace abc and the class is mapped to your_url, then the API URL is modified as follows: https://instance.salesforce.com/services/apexrest/abc/your_url/. In the case of a URL collision, the namespaced class is always used.

more help

More Apex Developer Guide Help