You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 3 Next »
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
- Create an API module.
- Create an API version.
- Configure API actions.
- Configure API request parameters.
- Bind API request parameters with appropriate API modules and actions.
Creating an API Module
To create an API Module, please complete the steps below:
- Navigate to Scripted REST API → API Module.
- Click New and fill in the form.
- Click Save or Save and Exit to apply changes.
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). |
Creating an API Version
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'. |
Configuring an API Action
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. |
Configuring API request parameters
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:
- Navigate to Scripted REST API → API Request Parameter.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
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. |
Configuring API action request parameters
To configure them, please complete the steps below:
- Navigate to Scripted REST API → API Action Request Param.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
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. |
Configuring API module request parameters
To configure them, please complete the steps below:
- Navigate to Scripted REST API → API Module Request Param.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
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. |
- No labels