HTTP API

Swagger UI

2N® Access Commander API
 v2 

[ Base URL: /api/v2 ]

Important note

This documentation file purpose is to help Access Commander development team as a reference manual.
This file IS NOT the official Access Commander API reference manual and might NOT always reflect the actual
version of the API endpoints. If you find any bug please report it to your distributor and he will schedule a
fix into future releases.

Address

The URL of AccessCommander's API is versioned and uses https, i.e. the url looks like https://serveraddress/api/v2/endpoint, where:

serveraddress is IP address of AC,

endpoint - see section Paths.

HTTP

Http commands used for communication with the server:

GET lists entities (getting the list of entities with parameter values)

PUT updates the entity (change of some parameters typically)

POST creates a new entity

DELETE deletes the entity

Data Structure

Server Response

Response structure:

{
  "data": {
    ...
  }
}

Every response is wrapped in the object "data". This arrangement offers the advantage of sending metadata in the response, for instance:

{
  "meta": {
    "code": 200
  },
  "data": {
    ...
  },
  "pagination": {
    "next_url": "...",
    "next_max_id": "13872296"
  }
}

Errors

401 unauthorized

500 and higher server errors, the structure looks like this:

{
  "data": {
  errornumber:123456
  errortext:"example"
  }
}

Authentication

The user sends a request containing username and password to the endpoint /login.
If the pair is valid, the server creates the cookie and sends it back to the browser.
All consequent requests are sent to the server along with the cookie. The server always verifies
if the cookie is valid. If it is not, it returns 401 in response. The cookie is deleted by sending
request to the endpoint /logout.

Version Number and Tags

users

User entity

devices

Device entity

auth

Logging in and out

presence

Presence entity

cards

Card entity

userRight

Right of ordinary user

adminRight

Administrator right

accessManagerRight

Right of manager of access

userManagerRight

Right of manager of users

anonymous

Login is not required to access the endpoint