Connect your apps to ProcessWire! This module helps you to create api-endpoints, to which an app or an external service can connect to.

Connect your apps to ProcessWire CMS!

This module helps you to create an api, to which an app or an external service can connect to.

A special thanks goes to Thomas Aull , whose module RestApi was the starting point to this project.

Credits: go to Benjamin Milde for his code example on how to use FastRoute with ProcessWire and Camilo Castro for this Gist

Current Version Current Version Current Version

Buy Me A Coffee

Features


  • Simple routing definition
  • Authentication - Three different authentication-mechanisms are ready to use.
  • Access-management via UI
  • Multiple different applications with unique access-rights and authentication-mechanisms can be defined

Table of Contents


Installation


AppApi can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules

The prerequisites are PHP>=7.2.0 and a ProcessWire version >=3.93.0. However, this is also checked during the installation of the module. No further dependencies.

Changelog


Changes in 1.1.3 (2021-02-09)

  • Fixes an issue with the constructor signature of the modules AppApiException class (by @twinklebob, thanks for PR )
  • Fixes an issue with the error-handler, which made it mistakenly catch errors that should have been ignored via @ operator (Thanks to @eelke)
  • Switched from wire('input')->url to $_SERVER['REQUEST_URI'] for reading the base-url, because ProcessWire's internal function transferred everything to lowercase

Changes in 1.1.2 (2021-01-18)

  • Fixes an error that occurred when something other than an array was to be output as response

Changes in 1.1.1 (2021-01-13)

  • Fixes critical issue "incorrect integer value" that happened in some db-configurations

Changes in 1.1.0 (2021-01-03)

  • Improved AppApi-dashboard
  • Allow multiple levels to routing config (by @twinklebob, thanks for PR )
  • Allow requests without an api-key: You can now mark an application as "default application". If you did so, every request without an apikey will be linked with that application.
  • You can now set a custom response-code in case of success. Simply include your response-code number on key "responseCode" in your result-array.
  • Optional access-logging: You can enable access-logging in the module's configuration. After that, every successful request will be logged with it's application-id, apikey-id and token-id.
  • Added hooks to all essential functions - that should enable you to customize the module's behavior even more. E.g. you could add custom logging on a hook, if you need that
  • Database-scheme does not need foreign-key constraints any more. That should fix @thomasaull 's issue with db-backups. After the update, you must remove the constraint manually because I did not find a way to remove the foreign key safely in all database-environments.
  • Multiple other bugfixes

Changes in 1.0.4 (2020-08-17)

  • Usage of ProcessPageView::pageNotFound-hook to allow other modules and functions to initialize before the api renders.
  • The path to Routes.php is now configurable via module's settings (Thanks to @thomasaull and @spoetnik)

Changes in 1.0.3 (2020-08-08)

  • Bugfix in Router.php (Thanks to @thomasaull)

Changes in 1.0.2 (2020-07-25)

  • Documentation improvements

Changes in 1.0.1 (2020-07-11)

  • Changed all auth-routes to the /auth (or /auth/access) endpoints.
  • Updated readme and examples

Changes in 1.0.0 (2019-08-19)

  • Rewritten most of the code
  • Setup application management ui
  • New authentication methods

Versioning


We use SemVer for versioning. For the versions available, see the tags on this repository.

License


This project is licensed under the Mozilla Public License Version 2.0 - see the LICENSE.md file for details.


Continue with 2: Defining Applications

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • This week ProcessWire gained powerful new tools for finding pages and controlling how they are loaded. If you like to maximize performance and efficiency, you’ll like what 3.0.172 brings— More
    5 February 2021
  • ProcessWire 3.0.171 dev branch core updates – More
    22 January 2021
  • Preliminary 2021 roadmap in progress in this week’s update— More
    8 January 2021

Latest news

  • ProcessWire Weekly #354
    In the 354th issue of ProcessWire Weekly we're going to check out the latest core updates, properly introduce the ProcessCKInlineComplete module, and dig into a brand new site of the week. Read on!
    Weekly.pw / 20 February 2021
  • ProcessWire 3.0.172 – Find faster and more efficiently
    This week ProcessWire gained powerful new tools for finding pages and controlling how they are loaded. If you like to maximize performance and efficiency, you’ll like what 3.0.172 brings.
    Blog / 5 February 2021
  • Subscribe to weekly ProcessWire news

“We chose ProcessWire because of its excellent architecture, modular extensibility and the internal API. The CMS offers the necessary flexibility and performance for such a complex website like superbude.de. ProcessWire offers options that are only available for larger systems, such as Drupal, and allows a much slimmer development process.” —xport communication GmbH