WordPress Membership Plugin
I managed to make it work with Postman by putting swpm_api_action and key in “Params” and first_name, last_name and email in “Body” and by choosing form-data. It gives a 200 OK status and the member is created in WP.
But now I’m trying to do the same thing with a code written with apps script:
function make_POST() {
var url = ‘https://mycanonicalurl/?swpm_api_action=create&key=5e4aa7acd2858b45xxxxxxxxxxxxxxxxx’;
var body = {
first_name: ‘Bruce’,
last_name: ‘Wayne’,
email: ‘bwayne@example.com’
};
var options = {
method: ‘POST’,
payload: JSON.stringify(body),
muteHttpExceptions: true
};
//try {
var response = UrlFetchApp.fetch(url, options);
var responseCode = response.getResponseCode();
Logger.log(‘response code: ‘ + responseCode);
/*
}
I got an error code 307 and it doesn’t create the member.
Someone can help to figure out the problem please?