Skip to content

UGX-Mods/phplist-plugin-restapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

205 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpList REST API plugin

Build Status

⚠️ Modifications compared to base

⚠️ First of all, the changes are not fully tested and might introduce bugs / security issues! ⚠️ Don't use the API als public endpoint, only communicate with the API from your server ⚠️ Configure a user with strong password and only allow your server IP addresses!

Fixes

  • Fixes #70
  • Fixes #35
  • Fixed listsSubscriber to include the entered and modified dates from the user as user_entered & user_modified

Changes

  • some cleanup
  • listsGet has a new param active=0/1 (default: 0), if 1 it will only get active (non private) lists
  • Response->SetError Response::outputError & Response::outputErrorMessage accepts optional extra data

Additions

  • Implements PR #71
  • Added helper function Response::outputOk (similar to the other output helpers)
  • Added new settings restapi_server_headers
  • Added extra function to format text list
  • Added addUserHistoryWrapper for better addUserHistory support
    • Allow the API to send server_headers in API call which is used instead of the API ones
    • (this allows correct IP and other details to be logged)
    • ⚠️ Untested of side effects, nothing known yet (it's just not a nice approach...)
    • ⚠️ must be enabled via new setting
  • Added various helper functions for Subscribers

New Commands

  • cmd addEmailToBlacklist
    • add email to blacklist
  • cmd subscriberGetWithAttributes
    • get subscriber, including all it's user attributes as user_attributes => [...]
  • cmd subscriberUpdateExtended
    • This function is quite heavy but acts similar to the subscribe page
    • Allows partial updates of fields
    • Supports to send update email, including new email confirm
    • List subscription changes won't mess with existing subscriptions (the entered date will be kept if already subscribed!)
    • Also handles re-subscribe!
  • cmd subscriberUnsubscribe
    • add user to blacklist, marks him blacklist=1 and send out an unsubscribe email
    • does respect UNSUBSCRIBE_CONFIRMATION config entry
  • cmd subscriberResendConfirmationEmail
    • Allow to resend the confirm email
  • cmd subscriberUpdateAttributesExtended
    • improved function to update/remove user attributes
    • 🟥 Incomplete and won't work

TODO

  • Fix all code documentation comments (including the new added ones) and improve the logic
  • fix tests and make it work with php8.2
  • add more tests ^^
  • implement better attributes handling

Notes

  • This is not truly a restful plugin, but "gets the job done" for now and is better than nothing
  • Status code is usually always 200, regardless of success or error, always check the response

About this plugin

This repository contains the REST API Plugin v2 for phpList 3. It is contained within the plugins folder, along with respective documentation and plugin-specific tests.

About

REST API as a plugin for phpList/phpList3

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • PHP 79.6%
  • HTML 19.9%
  • Gherkin 0.5%