Flocknote API - members

« Back to Flocknote API Documentation home

Get the current member's information

GET /members

Accessing the members object with no ID will return information about the current member with the following JSON array:

{
  "id" : "125",
  "first" : "John",
  "last" : "Doe",
  "email" : "johndoe@example.com",
  "phone" : "1234567890",
  "networks" : ["123","456"],
  "lists" : ["412","436","291"]
}

Example — Get current member's information using Flocknote's SDK for PHP:

require_once('flocknote.php');
 
if ($flocknote = new Flocknote(APINAME, APIKEY)) {
  // Set the username and password for this request.
  $flocknote->setUserCredentials(USERNAME, PASSWORD);
 
  // Get the current member's information.
  $member = $flocknote->getMember();
}

Get a particular member's information

GET /members/[id]

Accessing the members object with an ID will return information about the member (if the requesting member has access to the member ID's profile information) with the following JSON array:

{
  "id" : "133",
  "first" : "Jane",
  "last" : "Doe",
  "email" : "janedoe@example.com",
  "phone" : "1234567891",
  "networks" : ["123","456"],
  "lists" : ["412","436","291"]
}

Example — Get current member's information using Flocknote's SDK for PHP:

require_once('flocknote.php');
 
if ($flocknote = new Flocknote(APINAME, APIKEY)) {
  // Set the username and password for this request.
  $flocknote->setUserCredentials(USERNAME, PASSWORD);
 
  // Get a particular member's information.
  $member = $flocknote->getMember(133);
}

Create a Member

POST /members

To submit a new member, don't provide an id in the URL, but include JSON in the body of the http request with the following items:

  • first_name - The member's first name.
  • last_name - The member's last name.
  • email - The member's email address (must conform to RFC 5321 SMTP address standard).
  • password - The member's chosen password. (See our password guidelines for more information about how we deal with passwords).
  • list_id - The list to which this member should be subscribed.

Example JSON body for a new member:

{
  "first_name" : "John",
  "last_name" : "Doe",
  "email" : "johndoe@example.com",
  "password":"123456",
  "list_id" : 123,
}

If the member was successfully created and subscribed to the list, you will receive HTTP code 201 and the id of the new member in the response body:

{
  "id" : 57299
}

If the member could not be saved, you will receive HTTP code 400 and an Error in the response body:

{
  "Error" : true,
  "ErrorMessage" : "Member could not be added to the given list."
}

(Alternatively, if your request was missing one of the required parameters, you'll receive ErrorMessage "Member was missing required parameters.")

Example — Create a new member, using Flocknote's SDK for PHP:

require_once('flocknote.php');
 
if ($flocknote = new Flocknote(APINAME, APIKEY)) {
  // Set the username and password for this request.
  $flocknote->setUserCredentials(USERNAME, PASSWORD);
 
  $member = array(
    'first_name' => 'John',
    'last_name' => 'Doe',
    'email' => 'johndoe@example.com',
    'password' => '123456',
    'list_id' => 123,
  );
 
  // If succesful, the new member id is stored in $member['id'].
  $member = $flocknote->addMember($member);
}