Scripted REST API functionality allows application developers to build custom APIs
Есть раздел в навигаторе, есть вот эти пункты (API Module, API version, API action, API request parameter, API Action request param, API module request param), ведут на определенные справочники.
Сначала админ создает у себя API Module
Path - поковыряться в сервиснау
API Module это сущность, требуемая для объединения прочих сущностей, API version, API action.
Для создания нужно перейти в Scripted REST API → API Module и нажать New
How to implement your custom API
To create an API Module, please complete the steps below:
API Module form fields
Field | Description |
---|---|
Name | Specify the API module name. |
Path | Relative path to the API module, for example, '/api/cmdb.' |
Active | Select this checkbox to make the module active or inactive. When set to FALSE, you'll be unable to choose this module in referencing tables (API Version, API Action, API Module Request Parameters). |
API version form fields
Field | Description |
---|---|
Module | Specify the API module created earlier for this version. |
Active | Select this checkbox to make the version active or inactive. When set to FALSE, you'll be unable to choose this version in referencing tables (API Action). |
Path | Path to the API version, for example, 'v1'. |
API action form fields
Field | Description |
---|---|
Name | The action name. |
Path | A path for API action. |
Active | Select this action to make the version active or inactive. When set to FALSE, you'll be unable to choose this version in referencing tables (API Action Request Parameter). |
Is Authentication Required | Select this checkbox if the request requires authentication before execution. The token is transmitted in the request header. |
Module | Choose the API Module created earlier (module must be activated before choosing). This field references the API Module (sys_api_module) table. |
Version | Choose the API version created earlier (version must be activated before choosing). This field references the API Version (sys_api_version) table. |
HTTP Method | Select the method this action implements (GET, or POST, for example). |
Script | Specify a script implementing your action. You can use SimpleRequest and SimpleResponse server-side API classes there. |
In there, you can specify the request parameters, for example, you can make the parameter mandatory for all referenced API essences.
To configure this, please complete the steps below:
API Request parameter form fields
Field | Description |
---|---|
Name | The request parameter name. |
Is required | Select this checkbox to make this parameter mandatory for all referenced API essences. |
To configure them, please complete the steps below:
API action request parameters form fields
Field | Description |
---|---|
Action | Specify the API action created earlier for which you need to define a related API request parameter. This field referenced the API action (sys_api_action) table. |
Request parameter | Specify a request parameter related to this action. When specified, an action referenced to this request parameter can use its options predefined in the API request parameters dictionary. This field references the Request Parameter (sys_api_request_param) table. |
To configure them, please complete the steps below:
API Module request parameters form fields
Field | Description |
---|---|
Module | Specify the API module created earlier for which you need to define a related API request parameter. This field references the API Module (sys_api_module) table. |
Request parameter | Specify a request parameter related to this module. When specified, all actions referenced to the module above can use this request parameter. This field references the Request Parameters (sys_api_request_param) table. |