Access Control API
Access Control API
Version Description
1 2022-08-10 Initial version
Table of contents
Access Control API ........................................................................................... 1
1 Installation ................................................................................................. 3
2 Configuration ............................................................................................. 3
2.1 Create technical user account used for API communication ..............3
2.2 Adjust Identity Server appsettings files ..............................................4
3 REST API .................................................................................................. 4
3.1 Accessing Swagger UI .......................................................................4
3.1.1 Authenticate session ...................................................................4
3.2 Authentication .....................................................................................5
3.3 Paging ................................................................................................5
3.4 Versioning ..........................................................................................5
3.5 Example Requests .............................................................................5
3.5.1 Get version information ...............................................................5
3.5.2 Query available employees .........................................................6
3.5.3 Create an employee ....................................................................6
3.5.4 Create an access card assigned to the created employee .........7
3.5.5 Assign an access authorization to an employee .........................7
3.5.6 Update an employee ...................................................................7
3.5.7 Delete an employee ....................................................................8
3.5.8 Get devices .................................................................................8
3.5.9 Get device type information ........................................................9
3.5.10 Execute a command request ......................................................9
3.5.11 Reply to an access request message .......................................10
4 gRPC API ................................................................................................ 10
4.1 Authentication ...................................................................................11
4.2 Example messages ..........................................................................11
Building Technologies
Page 2 of 13
Building Technologies
1 Installation 3 13
As a prerequisite for using the Access Control API, you need to have an AMS
instance installed and configured. Install AMS from the provided “AMS Server
Installer.exe” as outlined in the AMS Installation Guide.
2 Configuration
After the AMS installation has completed and you have restarted the system,
some additional manual configuration is required for Access Control API. The
following sections provide details on the required steps, which are:
• Create technical user account used for API communication
• Adjust Identity Server appsettings files
In order to create a new operator, you need first to create a new person. To
do this, start the AMS Dialog Manager and go to “Personnel data” >
“Persons”. Fill in an arbitrary value in “Last name” and select “Employee” as
the value for “Person class”. Save the record.
After this go back to the main menu and then to “Configuration” > “Operators
and Workstations” > “User rights”. Search for the created employee, if not
selected anymore. Enter a value into “User name”, this will be later used as
client identifier. Click now on “Change password …” and select a password for
the user.
If you have multiple divisions configured, you have to go to the “Divisions” tab
in the same dialog and assign all divisions you want the API has access to.
For example, if you don’t assign a division “Test Division” you won’t get any
state changes or event messages. Besides, you will not be able to read,
create, update or delete entities like employees for the division.
Page 3 of 13
Building Technologies
{
"ClientOptions": {
"Clients": {
"AmsIntegration": {
"ClientId": "<OPERATOR-USERNAME>",
"ClientName": "<NAME-OF-YOUR-APPLICATION>",
"AllowedGrantTypes": [
"client_credentials"
],
"AccessTokenLifetime": 1800,
"AllowedScopes": [
"ProductApi"
],
"Properties": {
"IsOperatorBacked": "true"
}
}
}
}
}
When finished, start the “ACE Process Control” application. (By default, the
AMS setup will place a shortcut to on your desktop.) Select the row labelled
IDENTITYSERVER and click the button “Restart process”.
3 REST API
The REST API can be accessed at https://<YOUR-HOSTNAME>:62999/.
Page 4 of 13
Building Technologies
The Swagger UI will not refresh your access token when it expires after 30
5 13
minutes. When the access token expires, click the “Authorize” button, press
“Logout” and “Authorize” to get a new access token.
3.2 Authentication
Most requests to the Access Control API endpoint must be authenticated. The
API relies on the Client Credentials flow in OpenID Connect for authentication.
You can obtain a compliant JWT-format token from the AMS’ Identity Provider
based on the OpenID Connect client application you have configured. Pass
the acquired access token in an Authorization: Bearer ... HTTP header
in requests.
For the Swagger UI you can authenticate the session from the UI itself.
3.3 Paging
By default, the API will limit the amount of data returned from a single request
to avoid overloading the client application, and return only the first batch of
items for each query. When this occurs, the server response will include a
non-null cursor property, which you can then pass to a subsequent request in
order to fetch the next batch of results.
3.4 Versioning
If you do not explicitly specify a version in your request, the API assumes that
you want to use the most recent version.
For the query string, you can extend the route with the version information
e.g. GET https://<YOUR-HOSTNAME>:62999/api/version?api-version=1.0.
When using the Media Type Header you need to add an Accept header to the
request with application/json;v1.0 to specific version 1.0.
Page 5 of 13
Building Technologies
Payload:
{
"firstName": "John",
"lastName": "Doe",
"birthName": null,
"personnelNumber": "12345678",
"dateOfBirth": "1960-10-23",
"gender": "Male",
"department": null,
"jobTitle": null,
"eMail": "john.doe@mail.com",
"phoneHome": "+49 (000) 000 00000",
"phoneBusiness": null,
"phoneMobile": null,
"phoneOther": null,
"companyId": null,
"divisionId": "FF0000D300000002"
}
In the response you will find a header value called Location, for instance:
Location: https://<YOUR-
HOSTNAME>:62999/api/employees/00139D53B66AAF67
Page 6 of 13
Building Technologies
It depends on the used card encoding but it is usually split into two parts:
1. The higher 8 bits, which is usually fixed and dependent on the card type and
technology, like 0000000100000004 (marked bold digits represents the
higher 8 bits)
2. The most lower 8 bits which represent the card number itself in HEX value
(usually printed on the card): 0000000100000004 (marked bold digits
represents the lowest 8 bits)
Same as the employee, you will find the identifier in the response headers.
Get the current access authorizations with the route GET https://<YOUR-
HOSTNAME>:62999/api/accessAuthorizations.
From this, you can get the identifiers required for assigning an access
authorization to an employee.
The first identifier is from the created employee, the second one is an
identifier of an access authorization.
Page 7 of 13
Building Technologies
8 13
Route: PUT https://<YOUR-
HOSTNAME>:62999/api/employees/00139D53B66AAF67
Payload (providing only a subset of properties here, all other properties will be
reset - see below for details):
{
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1960-10-23",
"gender": "Male",
"eMail": "john.doe@mail.com",
"phoneHome": "+49 (123) 000 00000"
}
All PUT requests have in common that omitting a property is the same as
setting the property to the default value (like null).
The default response code for PUT requests is 204 No Content which
indicates that the request was successfully accepted and the entity is changed
accordingly.
The DELETE request, like the PUT request, answers with a 204 No Content
when the employee is successfully deleted.
Page 8 of 13
Building Technologies
"description": "DMS-Server",
"parentId": null, 9 13
"deviceTypeId": "DMS",
"capabilities": []
},
],
"nextCursor": null
}
Example request:
{
"id": "MAC",
"name": "MAC",
"description": "Main Access Controller",
"stateTypeIds": [
"CONNECTION",
"ASM"
],
"commandTypeIds": [
"MacEnableAccessSequenceMonitoring",
"MacDisableAccessSequenceMonitoring"
]
}
Example payload:
{
"deviceId": "FF00003300000003",
"commandTypeId": "MacEnableAccessSequenceMonitoring"
}
Example response:
{
"success": true,
"error": null,
"payload": {}
}
Page 9 of 13
Building Technologies
Important: The property success does not indicate if the command is executed
10 13
successfully, it describes that the command request was successfully issued.
If the MAC of the requested device is offline, you will always get an error
message, but e.g., if a reader is offline, you will get a success message as the
request was successfully sent to the MAC of the device.
Prerequisite: You need to configure your system to send access requests and
received an access request message.
The information for deviceId and credentialId can be found at the event
message.
4 gRPC API
With the gRPC API you are able to stream messages from the API to your
application. You can access the gRPC API at https://<YOUR-
HOSTNAME>:62998/.
In the folder of the Access Control API (default location is C:\Program Files
(x86)\Bosch Sicherheitssysteme\Access Management
Page 10 of 13
Building Technologies
4.1 Authentication
As already mentioned in the Authentication chapter for the REST API most
requests must be authenticated.
For a successful authentication you need to access the API with a SSL
connection and an access token as part of the metadata.
Example response:
{
"version": "1.0",
"assemblyVersion": "1.x.x.x",
"productVersion": "...",
"supportedVersions": [
"1.0"
],
Page 11 of 13
Building Technologies
"deprecatedVersions": []
} 12 13
Page 12 of 13
Building Technologies
13 13
Example message:
{
"sourceId": "00139D6A1A13F163",
"typeId": "DOOR",
"value": "OPEN",
"lastUpdated": "2022-01-01T12:00:00.0000000+02:00"
}
--End of document--
Page 13 of 13