The wlmapiclass handles external connections to the WishList Member API. It is the sister class for the WishListMemberAPIRequest() function included in WishList Member which handles all internal API requests.
This class along with wlmapiclass.php and functions.php are already installed in the latest version of WishList Member. You do NOT need to include them in your plugin/theme if you have WishList Member installed on your site. Simply begin calling functions or using the class to get started.
__construct($url, $key, $tempdir=null)
Constructor method for the class. Sets these properties used throughout the class: wlmapiclass:url, wlmapiclass:key, and wlmapiclass:tempdir. wlmapiclass:url is optional and the class will create a /tmp directory in the current folder if this is not specified.
_request($method, $resource, $data = ”)
Private method that process all requests. It requires the method (GET, POST, PUT, DELETE) and the resource. If the resource/method combination requires input data, that will be required here; otherwise, it is ignored. This is simply and internal helper and can't be called directly outside of the class.
Send a POST request to WishList Member API (add new data). Note that $data is required here.
Send a GET request to WishList Member API (retrieve data). Note that $data is optional here.
Send a PUT request to WishList Member API (update existing data). Note that $data is required here.
Send a DELETE request to WishList Member API (delete the resource). Note that $data is optional here.
Fixes API requests that omit a trailing slash which is required by the API. It adds the slash, if necessary. This is a private function that cannot be called directly outside the class.
Handles authentication with the WishList Member. This is a private function that cannot be called directly outside the class. Attempting to authenticate without accessing a resource will always return a “Not Authenticated” error.
This class is necessary for external API requests.