MinnPost/minnpost-wordpress

API endpoints

jonathanstegall opened this issue · 3 comments

We need to at least be able to:

  1. Send user info to MailChimp and create or update their subscription ✅
  2. Get user info from MailChimp (determine what lists they're subscribed to via an API url) ✅
  3. Check for city/state from zip code ✅
  4. Check if a user exists on the website with a given email address. ✅
  5. Create a user account on website ✅
  6. Change the URLs for these links on the Salesforce/Stripe app. This is done, it's just not live.

Full list of URLs from Drupal:

accounts

  1. /accounts/exists
  • accepts $_POST['email']
  • returns drupal_json(array('status' => 'success', 'reason' => 'user exists', 'uid' => $success->uid)); if successful
  1. /accounts/create
  • first checks to see if user exists. returns drupal_json(array('status' => 'success', 'reason' => 'user exists', 'uid' => $success->uid)); if user does exist.
  • accepts $_POST['email'], $_POST['password'], $_POST['first'], $_POST['last'], $_POST['city'], $_POST['state'], $_POST['zip'], $_POST['stripe_customer_id']
  • returns drupal_json(array('status' => 'success', 'reason' => 'new user', 'uid' => $success->uid)); if successful
  1. /accounts/check_zip
  • accepts $_POST['zipcode'] and $_POST['country']
  • returns drupal_json(array('status' => 'success', 'state' => $state, 'city' => $city)); if successful

mailchimp

  1. /mailchimp/minnpost/api
  • accepts $_POST['minnpost_mailchimp_js_form_action'] = 'newsletter_subscribe';, $_POST['minnpost_mailchimp_firstname'], $_POST['minnpost_mailchimp_lastname'], $_POST['minnpost_mailchimp_email']
  1. /mailchimp/minnpost/groups

We're using this branch of the SF/Stripe app to make these changes, and will merge it into master and deploy it to Heroku when the site is launched. https://github.com/MinnPost/salesforce-stripe/tree/switching-to-wordpress

This is fixed with the above branch, as of this commit. MinnPost/donations@908de7a