Making REST Requests with the JavaScript API
REST requests from a VDL or JS Insight view should be automatically include the authentication cookie in the request, as it will be within the same domain and session.
All REST resource URLs begin with /insightservices/rest/v1/data/
. However the request may require a prefix on the url path if the Insight server is running in an environment where path-based routing is used. The JavaScript API provides a method (available since Xpress Insight 4.55.0) that automatically adds the necessary prefix to the REST endpoint URL if it is required.
insight.resolveRestEndpoint
is documented in the JavaScript API Reference. Here is an example of making a REST request using the
resolveRestEndpoint
method:
var appsUrl = insight.resolveRestEndpoint('/insightservices/rest/v1/data/project');
fetch(appsUrl).then(function (response) {
return response.json();
})
.then(function (data) {
var appNames = data.items.map(function(item) {
return item.displayName;
});
console.log(appNames);
});
© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.