This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this.
If you want to query a member account profile using a HTTP GET or POST request then use this documentation.
Enabling the API
WP eMember plugin has an API that allows you to query a member’s profile using a standard HTTP GET or POST request. If you want to use this API then you need to enable it from the settings menu of the plugin first. The following is a screenshot of this section in the settings menu:
Using the API
Once you enable the API, you can start to send HTTP request to the following URL to query a member’s profile remotely or from another software/application:
http://www.example.com/wp-content/plugins/wp-eMember/api/query.php
You need to provide 2 pieces of information with the API request. These are:
- Secret Word/API Key (you specified it in the settings menu of the plugin)
- Member ID or the email address of the member.
The retrieved member data will be shown in JSON format.
1. Query Member Account Using HTTP GET request
In order to query a member account via HTTP GET request, use the following format:
http://www.example.com/wp-content/plugins/wp-eMember/api/query.php?secret_key=XX&member_id=XX
OR the following (if you want to query by email address of the member):
http://www.example.com/wp-content/plugins/wp-eMember/api/query.php?secret_key=XX&email=XX
Replace the ‘example.com’ and ‘XX’ with the appropriate values.
1. Query Member Account Using HTTP POST request
To query a member account via HTTP POST use the following format:
<form method="post" action="http://www.example.com/wp-content/plugins/wp-eMmeber/api/query.php"> <input type="hidden" name="secret_key" value="XX"> <input type="hidden" name="member_id" value="XX"> <input type=submit value="Submit Post"> </form>
Replace the ‘example.com’ and ‘XX’ with the appropriate value.
Just a little note to potential programmers. If everything is correct, this will return a JSON file with member_id and data. However ,,,
If there is a problem., (ie if the secret key is missing / API not switched on etc) it will return a standard error message to the calling script. If your app simply json_decode’s the result, the errors reports will “throw” an error as it will not be in the format the decoder can read. You should really check the format of the results to see if it’s text or JSON.
** Of the three API routines, this is the only one to ‘suffer’ this anomoly, and something potential programmers need to prepare for. (Of course, most times there will be no errors, but there could be a chance.