What is a REST API; what does it offer for managing TR7 programmatically?
Short answer
A REST API is an interface style that provides resource-based programmatic access over HTTP (Fielding, REST): every object is a resource, and the operations on it are listing, viewing, adding, updating and deleting. The TR7 management panel runs on top of the REST API on the device; the endpoints are documented in API7 Docs (platform components). In the interface, the direct counterpart of this API is the API Commands branch in WEB-CLI: the branch is derived from the REST interface of the panel; every resource becomes a node in the command tree, every operation becomes an action (list, show, add, update, delete, and update-many on the resources that support it), and the field names come from the same definitions as in the interface. Permission checking is the same as in the interface: read commands require view permission for the related area, and write commands require modify permission.
Where It Is Used in TR7
| Where | Field / label | What for |
|---|---|---|
| Bottom-right corner of the panel → WEB-CLI | API Commands branch (lb, waf, ags, gtm, network, settings…) | Managing resources with commands over the REST API |
| Same branch | Actions: list, show, add, update, delete; update-many on the resources that support it | The same set of operations on every resource |
| Settings → User Management → Device Users → user | Access CLI over WEB, Access CLI over SSH | Giving the user CLI access over WEB-CLI and SSH |
| Settings → System Logs → User Logs | User Logs | Also the record of the changes made over WEB-CLI and CLI; in these records, the source (@…) is written at the end of the User-agent column |
| docs.tr7.com | API7 Docs | The documentation of the REST API endpoints |
- The branches of WEB-CLI and the permission mapping: What is WEB-CLI; which command branches does it offer? · Command permissions: Access and permissions
- Managing the Load Balancer with commands: Can I manage the Load Balancer configuration via CLI or API?
Common Misconceptions
- "Every operation in the interface has a command counterpart." Some operations are available only in the interface; for example, in WAF, Signature & Rule Library and Allow / Teach (Can I manage the WAF with WEB-CLI; which operations are not available in WEB-CLI?).
- "API and CLI commands bypass permissions." Read commands require view permission for the related area, and write commands require modify permission; the permissions are the same as in the interface.
- "The
updatecommand rewrites all the fields of the record."updatereads the existing record and changes only the given fields; the other fields are preserved.
How it is done in the documentation
