/cli_api

CLI processor for web API

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

Build Status Scrutinizer Code Quality

A processor for API module. Essentially it translates HTTP requests into CLI commands and allows to execute CRUD commands provided by different CLI providers.

Every request URL must be constructed as such: /api/cli-command-name

Command options can be passed in the query string, POST body or both. Arguments from POST body will override arguments from GET query.

Examples

Get list of system events in JSON format. Use event-get from CLI module:

GET /api/event-get HTTP/1.1

With options, list only those with "danger" severity:

GET /api/event-get?severity=danger HTTP/1.1

Requirements:

Installation

  1. Download and extract to system/modules manually or using composer composer require gplcart/cli_api. IMPORTANT: If you downloaded the module manually, be sure that the name of extracted module folder doesn't contain a branch/version suffix, e.g -master. Rename if needed.
  2. Go to admin/module/list end enable the module