Angular JS REST client
bower install ape-js
npm install ape-js
Or download the package directly here
Insert this tag after your angularjs tag :
<script type="text/javascript" src="bower_components/ape-js/ape.js"></script>
/*
OR
*/
<script type="text/javascript" src="/ape-js/ape.js"></script>
/*
OR
*/
<script type="text/javascript" src="node_modules/ape-js/ape.js"></script>
var myApp = angular.module('myApp', ['Ape']);
...
myApp.controller('Cntrl', function ($scope, Ape) {
...
});
Request - function(verb String, url String, parameters Object, callback function(response, angular-http-response )
Perform an APE request to the desired url.
RESTful verb to use with request.
API endpoint to call.
Parameters to send with request. On PUT
and POST
requests, explicitly define url based parameters. ie : http://domain.com/url?param1
Called once the request is finished,
Checkout this sample request
Init - function(ape Ape)
Set a new Ape logic.
Desired Ape automation parameter set to use.
String to be prepended with each request.
Object with header parameters sent with each request.
Function called prior to each request.
end - function(response , angular-http-response )
Function called after each request.
Response of API request. This varies with the data your endpoint is sending.
** On API error the value of this model will always be false
.
In the example below a GET
request is performed to the endpoint /your/test/endpoint
.
Ape.Request("GET", "/your/test/endpoint", {param1: "azert"} , function(data){
console.log("response => ");
console.log(data);
});