How to Use Endpoints

 

The following is our recommended method to use the User Portal API in your custom pages.

STEP 1: Inject $http into your controller

(function() {
'use strict';
angular
.module('app.M1DashboardController')
.controller('MyController', MyController);

MyController.$inject = ['$http'];

function MyController($http) {
/* CODE HERE */
}
})();

STEP 2: Create HTTP request

Here is our recommended format for HTTP requests:

 var req = {
method: /* request method here, ie "POST" */,
url: /* endpoint here, ie "/tenant_read" */,
headers: {
'Content-Type': 'application/json'
},
params: /* dict of params here */
}
$http(req).then(function(res) {
/* handle response here */
}, function(err) {
/* handler error here */
});