An action via API?

@since 160625 ReST utils.

@param string $action Action identifier.

@return bool True if it's an action via API.
976380
protected function viaApi(string $action): bool
    {
        if (mb_strpos($action, 'api.') === 0) {
            return true; // Saves time in many cases.
        }
        return mb_strpos($action, 'api-v') === 0 && preg_match('/^api\-v[0-9]+[0-9.]*\./u', $action);
    }
374465
protected function _actionIsEnabled($action)
    {
        $actions = $this->type['actions'];

        if (array_key_exists($action, $actions)) {
            return $actions[$action];
        }
        return true;
    }
1171512
static function isCurrentAction( $action ) {

		if ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) {
			$compare = $_REQUEST['action'];
		} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) {
			$compare = $_REQUEST['action2'];
		} else {
			return false;
		}

		return ( $action === $compare );
	}
738516
protected function actionReferencesController($action)
    {
        if ($action instanceof Closure) {
            return false;
        }

        return is_string($action) || is_string(array_get($action, 'uses'));
    }
1299247
protected function setAction($action)
    {
        $this->action = trim(strtoupper($action));

        //	Check verb aliases, set correct action allowing for closures
        if (null !== ($alias = array_get($this->verbAliases, $this->action))) {
            //	A closure?
            if (in_array($alias, Verbs::getDefinedConstants()) || !is_callable($alias)) {
                //	Set original and work with alias
                $this->originalAction = $this->action;
                $this->action = $alias;
            }
        }

        return $this;
    }
1338066
protected function matchAction($action, $actions): bool
    {
        return in_array($action, $actions) || $this->matchWild($actions, $action);
    }
123122
public function hasActionTemplate($action)
    {
        if (isset($this->templates[$action])) {
            return true;
        }

        $parentClass = static::class;
        $templates   = array();

        while ($parentClass != __CLASS__) {
            $templates[] = strtok($parentClass, '_') . '_' . $action;
            $parentClass = get_parent_class($parentClass);
        }

        return SSViewer::hasTemplate($templates);
    }
125908
private function supportsAction($action)
    {
        if (null === $this->getSupportedActions()) {
            return true;
        }

        return in_array($action, $this->getSupportedActions());
    }
1225016
public function beforeAction($action)
    {
        if (in_array($action->controller->id, $this->controllers)) {
            throw new NotFoundHttpException('Not found');
        }

        return true;
    }
1196168
protected function _mapAction($action) {
		$actionMap = $this->getConfig('actionMap');
		if (isset($actionMap[$action]) && method_exists($this, $actionMap[$action]['method'])) {
			$pass = (array)$this->_getRequest()->param('pass');
			call_user_func_array([$this, $actionMap[$action]['method']], $pass);

			if ($this->_redirectResponse instanceof Response) {
				return $this->_redirectResponse;
			}

			if (is_string($actionMap[$action]['view'])) {
				try {
					return $this->getController()->render($this->getController()->request->param('action'));
				} catch (MissingTemplateException $e) {
					return $this->getController()->render($actionMap[$action]['view']);
				}
			}

				return $this->_getResponse();
			}

		return false;
	}
826067
protected function findMiddleware($action)
    {
        if (is_array($action) && isset($action['_middleware'])) {
            return $action['_middleware'];
        } elseif (isset($this->group['_middleware'])) {
            return $this->group['_middleware'];
        }

        return false;
    }
1048694
public function getActionUrl($action)
    {
        if (is_array($action->urlData) && $this->isOpenNewWindow)
        {
            $action->url = BackendUrlHelper::createByParams($action->urlData)
                ->enableEmptyLayout()
                ->enableNoActions()
                ->params
            ;
        };

        return $action->url;
    }
1111286
public function canExecute($action)
    {
        if (!$this->actor) {
            return false;
        }

        if (!$this->actor->isNotifiable()) {
            return false;
        }

        if ($this->actor->authorize('access') === false) {
            return false;
        }

        if ($this->actor->authorize('administration') === false) {
            return false;
        }

        return parent::canExecute($action);
    }
1355802
private function validateAction($action)
    {
        $actionAvailable = [self::ACTION_ADDFORCE, self::ACTION_ADDNOFORCE, self::ACTION_REMOVE, self::ACTION_UNSUB];
        if (in_array($action, $actionAvailable)) {
            return true;
        }
        return false;
    }
353618
public function doAction($action)
    {
        $controller = $this->getOption('hooks-controller');
        $instance = $this->getControllerInstance($controller);

        if (is_object($instance) && method_exists($instance, $action)) {
            $response = call_user_func([$instance, $action]);
        }

        $this->setAction('');

        return isset($response);
    }
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
1170009
private function isAllowedAction(Action $action): bool
    {
        if ($this->owner instanceof Module) {
            $ownerId = $this->owner->getUniqueId();
            $id = $action->getUniqueId();
            if (!empty($ownerId) && strpos($id, $ownerId . '/') === 0) {
                $id = substr($id, strlen($ownerId) + 1);
            }
        } else {
            $id = $action->id;
        }

        foreach ($this->allowActions as $route) {
            if (substr($route, -1) === '*') {
                $route = rtrim($route, '*');
                if ($route === '' || strpos($id, $route) === 0) {
                    return true;
                }
            } else {
                if ($id === $route) {
                    return true;
                }
            }
        }

        return false;
    }