In SuiteCRM is there api access similar to SUGAR.App.api.call() ?
Hi @toddtec,
yes, SuiteCRM has an API that can be accessed using REST (Representational State Transfer) calls. You can use the SuiteCRM API to create, read, update, and delete records in the system, as well as perform other operations such as searching for records and retrieving metadata.
To make REST calls to the SuiteCRM API, you can use any programming language that supports HTTP requests, such as JavaScript, PHP, Python, or Ruby. You can use the HTTP methods GET, POST, PUT, and DELETE to perform different operations on the SuiteCRM data.
To access the SuiteCRM API from JavaScript, you can use the jQuery.ajax() function or the Fetch API. You can also use a library such as Axios or Request to make HTTP requests to the API.
Hereβs an example of how you can make a REST call to the SuiteCRM API using JavaScript:
javascriptCopy code
// Make a GET request to retrieve a list of accounts from SuiteCRM
fetch('/api/v8/modules/Accounts', {
method: 'GET',
headers: {
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
In this example, replace ACCESS_TOKEN
with your actual access token, which you can obtain by authenticating with the SuiteCRM API. The fetch()
function is used to make the HTTP request to the API, and the response is parsed as JSON using the json()
method.
You can find more information about the SuiteCRM API in the SuiteCRM Developer Guide, which can be found in the documentation section of the SuiteCRM website.
Thank you for the reply.
The REST interface is different than the interface and related capabilities offered by SUGAR.App.api.call(). Many (not all) Sugar operations pass through this interface, so it is a good place to see/adjust data.
For example -
App.api.call = _.wrap(
App.api.call,
function (func, method, url, data, callbacks, options) {
console.log(method + " " + url);
func.call(App.api, method, url, data, callbacks, options);
});