Access Policy
The APIs here are designed for managing door access policies. These policies can be bound with access schedules, floors, and other door access resources.
Access Policy Schemas
| Parameter | Type | Description |
| Id | Identity ID of the access policy. | |
| name | String | Name of the access policy. |
| resources | Array[Object] | Specify the locations that can be accessed. |
| resources[].type | String | Include door and door_group resources. enum_type {door, door_group} |
| resources[].id | String | When resource type is door_group, it refers to the group ID of a building or a customized door group. When type is door, it refers to the ID of a door. |
| schedule_id | String | Identity ID of the schedule. |
Create Access Policy
This API allows you to create an access policy.
Request URL: /api/v1/developer/access_policies
Permission Key: edit:policy
Method: POST
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description | How to Get It? | Example |
| name | T | String | Name of the access policy. | ||
| resource | F | Array[Object] | Used to assign accessible locations to the access policy. | Get it from the API /api/v1/developer/door_groups/topology; /api/v1/developer/door_groups | |
| resources[].type | F | String | enum type {door, door_group} | ||
| resources[].id | F | String | When resource type is 'door_group', it refers to the group ID of a building or a customized door group. When type is 'door', it refers to the ID of a door. | ||
| schedule_id | T | String | Identity ID of the schedule. Assign additional schedules. | Get it from the API /api/v1/developer/access_policies/schedules |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the policy. | /api/v1/developer/users/:user_id/access_policies | Used to both assign an access policy to a user or unassign a policy from them. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/access_policies' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw '{
"name": "test",
"resources": [
{
"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
},
{
"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
},
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
}
],
"schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
}' \
--insecureResponse Sample
{
"code": "SUCCESS",
"data": {
"id": "bb5eb965-42dc-4206-9654-88a2d1c3aaa5",
"name": "test13",
"resources": [
{
"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
},
{
"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
},
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
}
],
"schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
},
"msg": "success"
}Update Access Policy
This API allows you to update a policy.
Request URL: /api/v1/developer/access_policies/:id
Permission Key: edit:policy
Method: PUT
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Example |
| Id | T | String | Identity ID of the access policy. |
Request Body
| Parameter | Required | Type | Description | How to Get It? |
| name | F | String | Name of the access policy. Omit this parameter if it doesn't need to be updated. | |
| resource | F | Array[Object] | Used to assign accessible locations to the access policy. Omit this parameter if it doesn't need to be updated. | Get it from the API /api/v1/developer/door_groups/topology; /api/v1/developer/door_groups |
| resources[].type | F | String | enum type {door, door_group} | |
| resources[].id | F | String | When resource type is door_group, it refers to the group ID of a building or a customized door group. When type is door, it refers to the ID of a door. | |
| schedule_id | F | String | Identity ID of the schedule. Assign additional schedules. Omit this parameter if it doesn't need to be updated. | Get it from the API /api/v1/developer/access_policies/schedules |
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/access_policies/242c88e3-0524-42de-8447-45891c5df714'
-H 'Authorization: Bearer wHFmHR******kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json' --data-raw
{'
"name": "test",
"resource": [
{"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
],
{"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
},
{"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
},
"schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
}
--insecureResponse Body
| Parameter | Required | Type | Description | Related api | Purpose |
| id | T | String | Identity ID of the policy. | /api/v1/developer/users/:user_id/access_policies | Used to both assign an access policy to a user or unassign a policy from them. |
See Response Schema for full field definitions.
Delete Access Policy
This API allows you to delete an access policy.
Request URL: /api/v1/developer/access_policies/:id
Permission Key: edit:policy
Method: DELETE
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description |
| Id | T | String | Identity ID of the access policy. |
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XDELETE '{host}'/api/v1/developer/access_policies/460d0bcc-5d4f-4e7b-8a3c-8d4502765e11'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
--insecureResponse Sample
{
"code": "SUCCESS",
"msg": "success",
"data": "success"
}Fetch Access Policy
This API allows you to fetch a policy details.
Request URL: /api/v1/developer/access_policies/:id
Permission Key: view:policy
Method: GET
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description |
| Id | T | String | Identity ID of the access policy. |
Response Body
| Parameter | Required | Type | Description | Example | |
| Data | T | Object |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/ccess_policy'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"data": {
"id": "ed09985f-cf52-486e-bc33-377b6ed7bbf2",
"name": "test11",
"resources": [
{
"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
},
{
"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
},
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
}
],
"schedule_id": "4e108aab-ec9a-4822-bf86-170ea986f934"
},
"msg": "success"
}Fetch All Access Policies
This API allows you to fetch all access policies.
Request URL: /api/v1/developer/access_policies
Permission Key: view:policy
Method: GET
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Response Body
| Parameter | Required | Type | Description | Example | |
| Data | T | Array[Object] |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/access_policies'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"data": [
{
"id": "73f15cab-c725-4a76-a419-a4026d131e96",
"name": "Default Admin Policy",
"resources": [
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
},
{
"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
}
],
"schedule_id": "73facd6c-839e-4521-a4f4-c07e1d44e748"
},
{
"id": "b96948a4-fed9-40a3-9c4a-e473822a3db7",
"name": "Default UNVR Policy",
"resources": [
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
},
{
"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
}
],
"schedule_id": "58c0f89b-f35c-4d2c-af7b-8b8918df2c31"
},
{
"id": "edbc80df-3698-49fd-8b53-f1867f104947",
"name": "TEST",
"resources": [
{
"id": "d5573467-d6b3-4e8f-8e48-8a322b91664a",
"type": "door_group"
},
{
"id": "5c496423-6d25-4e4f-8cdf-95ad5135188a",
"type": "door_group"
},
{
"id": "6ff875d2-af87-470b-9cb5-774c6596afc8",
"type": "door"
}
],
"schedule_id": "73facd6c-839e-4521-a4f4-c07e1d44e748"
}
],
"msg": "success"
}Holiday Group Schemas
A holiday group refers to a collection of holidays.
| Parameter | Type | Description |
| id | String | Identity ID of the holiday group. |
| name | String | Name of the holiday group. |
| is_default | Boolean | Indicate whether the holiday group is the system default. |
| description | String | Description of the holiday group. |
| holidays | Array[Object] | Show a list of the holidays within the holiday group. |
| holidays[].description | String | Description of the holiday. |
| holidays[].id | String | Identity ID of the holiday. |
| holidays[].name | String | Name of the holiday. |
| holidays[].repeat | Boolean | Indicate whether the holiday repeats annually. |
| holidays[].start_time | String | Start time of the holiday, provided in UTC format according to RFC3339. |
| holidays[].end_time | String | End time of the holiday, provided in UTC format according to RFC3339. |
Create Holiday Group
This API allows you to create a holiday group.
Request URL: /api/v1/developer/access_policies/holiday_groups
Permission Key: edit:policy
Method: POST
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description | Example |
| name | T | String | Name of the holiday group. | |
| description | F | String | Description of the holiday group. | |
| holidays | F | Array[Object] | Show a list of the holidays within the holiday group. | |
| holidays[].description | F | String | Description of the holiday. | |
| holidays[].name | F | String | Name of the holiday. | |
| holidays[].repeat | F | Boolean | Indicate whether the holiday repeats annually. | |
| holidays[].is_template | F | Boolean | Indicate whether the holiday is created using a holiday group template. | |
| holidays[].start_time | F | String | Start time of the holiday, provided in UTC format according to RFC3339. | 2023-08-25T00:00:00Z |
| holidays[].end_time | F | String | End time of the holiday, provided in UTC format according to RFC3339. | 2023-08-26T00:00:00Z |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the holiday group. | /api/v1/developer/access_policies/schedules | Used to add a holiday group to the schedule. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/access_policies/holiday_groups'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'-H 'content-type: application/json' --data-raw
{' "name": "Holiday Group-169286791557142", "holidays": [ "name": "Holiday Name 1", "description": "", "repeat": false, "start_time": "2023-08-25T00:00:00z", "end_time": "2023-08-26T00:00:00z"
}, "name": "Holiday Name 2", "description": "", "repeat": false, "start_time": "2023-08-26T00:00:00z", "end_time": "2023-08-27T00:00:00z"
} ]
}Response Sample
{
"code": "SUCCESS",
"data": {
"description": "",
"holidays": [
{
"description": "",
"end_time": "2023-08-26 00:00:00z",
"id": "8900533d-03be-4f84-832d-54ff59905759",
"name": "Holiday Name 1",
"repeat": false,
"start_time": "2023-08-25 00:00:00z"
},
{
"description": "",
"end_time": "2023-08-27 00:00:00z",
"id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
"name": "Holiday Name 2",
"repeat": false,
"start_time": "2023-08-26 00:00:00z"
}
],
"id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
"is_default": false,
"name": "Holiday Group-169286791557142",
"template_name": ""
},
"msg": "success"
}Update Holiday Group
This API allows you to update a holiday group.
Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: edit:policy
Method: PUT
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Example | |
| Id | T | String | Identity ID of the holiday group. |
Request Body
| Parameter | Required | Type | Description | Example |
| name | T | String | Name of the holiday group. | |
| description | F | String | Description of the holiday group. | |
| holidays | F | Array[Object] | Show a list of the holidays within the holiday group. Omit this parameter if it doesn't need to be updated. | |
| holidays[].id | F | String | Identity ID of the holiday. Omit this parameter if it doesn't need to be updated. | Get it from the API /api/v1/developer/access_policies/holiday_groups |
| holidays[].description | F | String | Description of the holiday. | |
| holidays[].name | F | String | Name of the holiday. | |
| holidays[].repeat | F | Boolean | Indicate whether the holiday repeats annually. | |
| holidays[].start_time | F | String | Start time of the holiday, provided in UTC format according to RFC3339. | 2023-08-25T00:00:00Z |
| holidays[].end_time | F | String | End time of the holiday, provided in UTC format according to RFC3339. | 2023-08-26T00:00:00Z |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the holiday group. | / api/v1/developer/access_policies/schedules | Used to add a holiday group to the schedule. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XPUT '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'
-H 'Authorization: Bearer wHFmHR****************kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json' --data-raw
{
"name": "Holiday Group-169286791557142",
"holidays": [
{
"name": "Holiday Name 1",
"description": "", "repeat": false,
"start_time": "2023-08-25T00:00:00z",
"end_time": "2023-08-26T00:00:00z"
],
# add a new holiday
{
"id": "d23a4226-765f-4967-b84f-6dfd53f33c89", # update an existing holiday
"name": "Holiday Name 2",
"description": "", "repeat": false,
"start_time": "2023-08-26T00:00:00z",
"end_time": "2023-08-27T00:00:00z"
}
}Response Sample
{
"code": "SUCCESS",
"data": {
"description": "",
"holidays": [
{
"description": "",
"end_time": "2023-08-26 00:00:00z",
"id": "8900533d-03be-4f84-832d-54ff59905759",
"name": "Holiday Name 1",
"repeat": false,
"start_time": "2023-08-25 00:00:00z"
},
{
"description": "",
"end_time": "2023-08-27 00:00:00z",
"id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
"name": "Holiday Name 2",
"repeat": false,
"start_time": "2023-08-26 00:00:00z"
}
],
"id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
"is_default": false,
"name": "Holiday Group-169286791557142",
"template_name": ""
},
"msg": "success"
}Delete Holiday Group
This API allows you to delete a holiday group.
Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: edit:policy
Method: DELETE
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Related API |
| id | T | String | Identity ID of the holiday group. | /api/v1/developer/access_policies/holiday_groups |
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XDELETE '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"data": "success",
"msg": "success"
}Fetch Holiday Group
This API allows you to fetch a holiday group.
Request URL: /api/v1/developer/access_policies/holiday_groups/:id
Permission Key: view:policy
Method: GET
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description |
| Id | T | String | Identity ID of the holiday group. |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the holiday group. | / api/v1/developer/access_policies/schedules | Used to add a holiday group to the schedule. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XGET '{host}/api/v1/developer/access_policies/holiday_groups/7be7a7a0-818f-4f76-98c3-1c38957f4dca'
-H 'Authorization: Bearer wHFmHR*****KD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"data": {
"description": "",
"holidays": [
{
"description": "",
"end_time": "2023-08-26 00:00:00z",
"id": "8900533d-03be-4f84-832d-54ff59905759",
"name": "Holiday Name 1",
"repeat": false,
"start_time": "2023-08-25 00:00:00z"
},
{
"description": "",
"end_time": "2023-08-27 00:00:00z",
"id": "9fff81cc-d476-40c4-80f9-d510451ce2cd",
"name": "Holiday Name 2",
"repeat": false,
"start_time": "2023-08-26 00:00:00z"
}
],
"id": "7be7a7a0-818f-4f76-98c3-1c38957f4dca",
"is_default": false,
"name": "Holiday Group-169286791557142",
"template_name": ""
},
"msg": "success"
}Fetch All Holiday Groups
This API allows you to fetch the list of all holiday groups.
Request URL: /api/v1/developer/access_policies/holiday_groups
Permission Key: view:policy
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description |
| Id | T | String | Identity ID of the holiday group. |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the holiday group. | /api/v1/developer/access_policies/schedules | Used to add a holiday group to the schedule. |
| name | T | String | Name of the holiday group. | ||
| description | T | String | Description of the holiday group. | ||
| count | T | Integer | Total number of holidays. |
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XGET '{host}/api/v1/developer/access_policies/holiday_groups'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"data": [
{
"count": 0,
"description": "",
"id": "8cc22b49-a7f4-49a6-9f04-044444992d6c",
"is_default": true,
"name": "No Holidays"
},
{
"count": 2,
"description": "",
"id": "86c634da-7b2c-411c-a2c1-1495d089c719",
"is_default": false,
"name": "Holiday Group-1692867312225"
}
],
"msg": "success"
}Schedule Schemas
These schemas are utilized for creating time periods for daily visits from Sunday through Saturday. The primary purpose of these schemas is to facilitate the assignment of access policies to users.
| Parameter | Type | Description |
| id | String | Identity ID of the schedule. |
| name | String | Name of the schedule. |
| is_default | Boolean | Indicate whether the schedule is the system default. |
| type | String | Contains the access type, which is assigned to a user along with an access policy. |
| weekly | Object | The customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day. |
| weekly monday | Array[Object] | Specify the daily access time period from Sunday to Saturday. |
| weekly monday[].start_time | String | Start time of the access time period. |
| weekly monday[].end_time | String | End time of the access time period. |
| holiday_schedule | Array[Object] | Specify the accessible period during holidays. UniFi Access Requirement: 1.20.11 or later |
| holiday_schedule[0].start_time | String | Start time of the access time period. |
| holiday_schedule[0].end_time | String | End time of the access time period. |
| holiday_group_id | String | Identity ID of the holiday group. |
| holiday_group.id | String | Identity ID of the holiday group. |
| holiday_group.name | String | Name of the holiday group. |
| holiday_group.is_default | Boolean | Indicate whether the holiday group is the system default. |
| holiday_group.description | String | Description of the holiday group. |
| holiday_group.holidays | Array[Object] | Show a list of the holidays within the holiday group. |
| holiday_group.holidays[].description | String | Description of the holiday. |
| holiday_group.holidays[].id | String | Identity ID of the holiday. |
| holiday_group.holidays[].name | String | Name of the holiday. |
| holiday_group.holidays[].repeat | Boolean | Indicate whether the holiday repeats annually. |
| holiday_group.holidays[].start_time | String | Start time of the holiday, provided in UTC format according to RFC3339. |
| holiday_group.holidays[].end_time | String | End time of the holiday, provided in UTC format according to RFC3339. |
Create Schedule
This API allows you to create a door access schedule.
Request URL: /api/v1/developer/access_policies/schedules
Permission Key: edit:policy
Method: POST
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Body
| Parameter | Required | Type | Description | Example |
| name | T | String | The name of the schedule. This needs to be globally unique. | schedule-1789067565323 |
| week_schedule | T | Object | The customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day. | |
| week_schedule monday | T | Array[Object] | Specify the daily access time period from Sunday to Saturday. | |
| week_schedule monday[0].start_time | T | String | Start time of the access time period. | 00:00:00 |
| week_schedule monday[0].end_time | T | String | End time of the access time period. | 23:59:59 |
| holiday_group_id | F | String | Identity ID of the holiday group. The default is No holidays system group. | 75660081-431b-4dbe-9b98-e0257877118e |
| holiday_schedule | F | Array[Object] | Specify the accessible period during holidays. | |
| holiday_schedule[].start_time | F | String | Start time of the access time period. | 03:15:00 |
| holiday_schedule[].end_time | F | String | End time of the access time period. | 11:45:59 |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the schedule. | /api/v1/developer/access_policies | Used to add a schedule to the access policy. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl '{host}/api/v1/developer/access_policies/schedules' \
-H 'Authorization: Bearer wHFmHR*****kD6wHg' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw '{
"name": "schedule-1688977094169",
"week_schedule": {
"sunday": [],
"monday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"tuesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"wednesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"thursday": [],
"friday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"saturday": []
},
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"holiday_schedule": [
{ "start_time": "03:15:00", "end_time": "11:45:59" },
{ "start_time": "15:00:00", "end_time": "19:00:59" }
]
}' \
--insecureResponse Sample
{
"code": "SUCCESS",
"data": {
"id": "1d31b648-b8ff-4bd1-b742-60dbd70592cd",
"is_default": false,
"name": "schedule-1688977094169",
"type": "access",
"weekly": {
"friday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"monday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"saturday": [],
"sunday": [],
"thursday": [],
"tuesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"wednesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
]
},
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"holiday_group": {
"description": "",
"holidays": [
{
"description": "",
"end_time": "2023-08-26 00:00:00z",
"id": "d51777c4-9559-45aa-8e23-434995d9d2a1",
"is_template": false,
"name": "Holiday Name 1",
"repeat": false,
"start_time": "2023-08-25 00:00:00z"
},
{
"description": "",
"end_time": "2023-08-27 00:00:00z",
"id": "d23a4226-765f-4967-b84f-6dfd53f33c89",
"is_template": false,
"name": "Holiday Name 2",
"repeat": false,
"start_time": "2023-08-26 00:00:00z"
}
],
"id": "75660081-431b-4dbe-9b98-e0257877118e",
"is_default": false,
"name": "Holiday Group-1692867915571423",
"template_name": ""
},
"holiday_schedule": [
{ "start_time": "03:15:00", "end_time": "11:45:59" },
{ "start_time": "15:00:00", "end_time": "19:00:59" }
]
},
"msg": "success"
}Update Schedule
This API allows you to update a door access schedule.
Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: edit:policy
Method: PUT
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Example | |
| Id | T | String | Identity ID of the schedule. |
Request Body
| Parameter | Required | Type | Description | Example |
| name | F | String | The name of the schedule. This needs to be globally unique. Omit this parameter if it doesn't need to be updated. | schedule-1789067565323 |
| week_schedule | F | Object | The customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day. Omit this parameter if it doesn't need to be updated. | |
| week_schedule.monday | F | Array[Object] | Specify the daily access time period from Sunday to Saturday. | |
| week_schedule.monday[0].start_time | F | String | Start time of the access time period. | 00:00:00 |
| week_schedule.monday[0].end_time | F | String | End time of the access time period. | 23:59:59 |
| holiday_group_id | F | String | Identity ID of the holiday group. The default is No holidays system group. | 75660081-431b-4dbe-9b98-e0257877118e |
| holiday_schedule | F | Array[Object] | Specify the accessible period during holidays. | |
| holiday_schedule[].start_time | F | String | Start time of the access time period. | 03:15:00 |
| holiday_schedule[].end_time | F | String | End time of the access time period. | 11:45:59 |
Response Body
| Parameter | Required | Type | Description | Related API | Purpose |
| id | T | String | Identity ID of the schedule. | /api/v1/developer/access_policies | Used to add a schedule to the access policy. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XPUT '{host}/api/v1/developer/access_policies/schedules/1d31b648-b8ff-4bd1-b742-60dbd70592cd'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json' --data-raw
{'
"name": "schedule-1688977094169",
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"week_schedule": {
"sunday": [],
"monday": [
{
"start_time": "10:00:00",
},
"end_time": "17:00:59"
]
],
"tuesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"wednesday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"thursday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"friday": [
{ "start_time": "10:00:00", "end_time": "17:00:59" }
],
"saturday": []
},
"holiday_schedule": [
{ "start_time": "03:15:00", "end_time": "11:45:59" }
]
}' \
--insecureResponse Sample
{
"code": "SUCCESS",
"data": {},
"msg": "success"
}Fetch Schedule
This API allows you to fetch a door access schedule.
Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: view:policy
Method: GET
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Example |
| Id | T | String | Identity ID of the schedule. |
Response Body
| Parameter | Required | Type | Description | Example |
| name | T | String | Name of the schedule. | |
| week_schedule | T | Object | The customizable scheduling strategy for each day from Sunday to Saturday. If not specified, it means access is allowed every day. | |
| holiday_group | F | Object | Show the assigned holiday group. | |
| holiday_schedule | F | Array[Object] | Show the accessible period during holidays. |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl --location '{host}/api/v1/developer/access_policies/schedules/908079e7-e26b-4951-9073-d775446d3584' --header 'Authorization: Bearer wHFmHR*****kD6wHg'Response Sample
{
"code": "SUCCESS",
"data": {
"id": "1d31b648-b8ff-4bd1-b742-60dbd70592cd",
"is_default": false,
"name": "schedule-1688977094169",
"type": "access",
"weekly": {
"friday": [
{
"end_time": "17:00:59",
"start_time": "10:00:00"
}
],
"monday": [
{
"end_time": "17:00:59",
"start_time": "10:00:00"
}
],
"saturday": [],
"sunday": [],
"thursday": [
{
"end_time": "17:01:59",
"start_time": "10:00:00"
}
],
"tuesday": [
{
"end_time": "17:00:59",
"start_time": "10:00:00"
}
],
"wednesday": [
{
"end_time": "17:00:59",
"start_time": "10:00:00"
}
]
},
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"holiday_group": {
"description": "",
"holidays": [
{
"description": "",
"end_time": "2023-08-26 00:00:00z",
"id": "d51777c4-9559-45aa-8e23-434995d9d2a1",
"is_template": false,
"name": "Holiday Name 1",
"repeat": false,
"start_time": "2023-08-25 00:00:00z"
},
{
"description": "",
"end_time": "2023-08-27 00:00:00z",
"id": "d23a4226-765f-4967-b84f-6dfd53f33c89",
"is_template": false,
"name": "Holiday Name 2",
"repeat": false,
"start_time": "2023-08-26 00:00:00z"
}
],
"id": "75660081-431b-4dbe-9b98-e0257877118e",
"is_default": false,
"name": "Holiday Group-16928679155714",
"template_name": ""
},
"holiday_schedule": [
{
"end_time": "11:45:59",
"start_time": "09:15:00"
}
]
},
"msg": "success"
}Fetch All Schedules
This API allows you to fetch all door access schedules.
Request URL: /api/v1/developer/access_policies/schedules
Permission Key: view:policy
Method: GET
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Response Body
| Parameter | Required | Type | Description | Example |
| Data | T | Array[Object] |
See Response Schema for full field definitions.
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl --location '{host}'/api/v1/developer/access_policies/schedules'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
--insecureResponse Sample
{
"code": "SUCCEED",
"data": [
{
"id": "73facd6c-839e-4521-a4f4-c07e1d44e748",
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"is_default": true,
"name": "Always Access",
"status": 1,
"type": "access"
},
{
"id": "58c0f89b-f35c-4d2c-af7b-8b8918df2c31",
"holiday_group_id": "75660081-431b-4dbe-9b98-e0257877118e",
"is_default": false,
"name": "UNVR Schedule",
"status": 1,
"type": "access"
}
],
"msg": "success"
}Delete Schedule
This API allows you to delete a door access schedule.
Request URL: /api/v1/developer/access_policies/schedules/:id
Permission Key: edit:policy
Method: DELETE
Request Header
| Parameter | Required | Type | Description |
| Authorization | T | String | Token required for authentication and access control. |
Request Path
| Parameter | Required | Type | Description | Example | |
| Id | T | String | Identity ID of the schedule. |
Request Sample: Shell/cURL
The request body should be a JSON object containing the following fields:
curl -XDELETE '{host}/api/v1/developer/access_policies/schedules/f5355214-3a45-4e0b-9245-12df7075df37'
-H 'Authorization: Bearer wHFmHR*****kD6wHg'
-H 'accept: application/json'
-H 'content-type: application/json'
--insecureResponse Sample
{
"code": "SUCCESS",
"msg": "success",
"data": "success"
}