1
How to use CA4K RESTful API – ver 1.0.5
Use with CA4K 1.1.16.x or higher.
CA4K API is a framework that makes it easy to build HTTP services that reach a broad
range of clients, including browsers and mobile devices. This API was built as a wrapper
WebAPI form .NET [Link] and returns mostly JSON data.
1. Once the API is installed, the API site will be shown as “CA4K RESTfulAPI” on IIS.
2. By default RESTful API will be setup to use port 8081.
3. All functions use Authorization.
4. First get the access_token by calling the url [Link] ip>:8081/token
a. Body keys
i. Username <- ca4k operator name
ii. Password <- ca4k operator password
iii. Grant_type = password
5. Use the access_token returned and token_type = bearer to call all other functions.
6. Eg1: to get badgeinfo
a. [Link]
b. Body keys
i. Authorization = bearer XXXXXXXXXXXXXXXXXX… is the access_token return from
token request call.
7. Eg2: Register to receive events using signalr.
@section scripts{
@*test signalr*@
@[Link]("~/bundles/signalR")
<script src="/signalr/hubs"></script>
<script>
$(function () {
var alertHubService = $.[Link];
$.[Link]().done(() => [Link]());
[Link] = function (sde) {
[Link](sde);
};
[Link] = function (message) {
[Link](message);
};
});
</script>
2
3