0% found this document useful (0 votes)
2 views

CA4K RESTful API

The CA4K RESTful API, compatible with versions 1.1.16.x or higher, allows for the creation of HTTP services that cater to various clients and primarily returns JSON data. Users must obtain an access token via a specific URL to authorize API calls, and examples are provided for retrieving badge information and registering for event notifications using SignalR. The API operates on port 8081 and requires proper authorization for all functions.

Uploaded by

Carlos
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CA4K RESTful API

The CA4K RESTful API, compatible with versions 1.1.16.x or higher, allows for the creation of HTTP services that cater to various clients and primarily returns JSON data. Users must obtain an access token via a specific URL to authorize API calls, and examples are provided for retrieving badge information and registering for event notifications using SignalR. The API operates on port 8081 and requires proper authorization for all functions.

Uploaded by

Carlos
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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 CardAccess.API 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 http://<server 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. http://localhost:8081/Badges/BadgeInfo?badge=1234&facility=0
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*@
@Scripts.Render("~/bundles/signalR")
<script src="/signalr/hubs"></script>
<script>
$(function () {
var alertHubService = $.connection.alertHubService;
$.connection.hub.start().done(() => alertHubService.server.connect());

alertHubService.client.alertReceived = function (sde) {


console.log(sde);
};

alertHubService.client.hcsStatusReceived = function (message) {


console.log(message);
};
});
</script>
2
3

You might also like