Menu Close Menu
Menu
  • 0
    • Number of items in basket: 0

      • Your basket is empty.
      • Total: £0.00
      • Checkout
  • Add-ons
  • Support
    • Documentation
    • Report a Bug
    • Submit a Support Ticket
    • Get Involved
    • Terms and Conditions
  • Your Account
    • Register
  • Blog
  • Contact Us

MDJM REST API: Client

MDJM REST API: Client

Query clients via REST

The MDJM REST API includes the /client/ endpoint to enable a specific clients details to be retrieved.

The /client/ endpoint allows you to query the database by a client’s user ID, and then returns MDJM relevant information pertaining to that client.

Parameters

The /client/ endpoint requires one of two possible parameters to be sent along with the API request;

  • client_id (Optional)
    The user ID of the client you wish to retrieve.
  • client_email (Optional)
    The email address of the client you wish to retrieve.

If neither one of these parameters is provided, the request will return an error.

If validation succeeds and the client is located the following details will be returned;

  • ID (integer)
    The user ID of the client
  • first_name (string)
    First name of client
  • last_name (string)
    Last name of client
  • email (string)
    Email address of client
  • last_login (datetime)
    The last login time of the client
  • events (array)
    An array of the client’s events stored within MDJM (Event ID => Event date)
  • next_event (array)
    An array containing the ID and date of the client’s next event

Method

The /client/ endpoint accepts both the GET and POST HTTP methods.

Security

The /client/ endpoint requires security validation and therefore your API Key and Token need to be included within the API request. Furthermore, the API will determine whether or not the client_id being specified is indeed that of a client. if it is not, an error will be returned.

Example API Call

To retrieve information for the client with user ID 62, the following would be used;

http://<yoursite.com>/wp-json/mdjm/v1/client/?api_key=03e8d350690c06b6106edc7936bd2b96&token=b35b7c30f56e2975dcc7dc171db90cdb&client_id=62

Response

The response from the above query would look like;

{
    "data": {
        "client": {
            "first_name": "Jonathan",
            "last_name": "King",
            "email": "[email protected]",
            "login": "[email protected]",
            "last_login": "2016-07-15 14:42:47",
            "events": {
                "7792": "2016-08-27",
                "8872": "2016-12-31"
            },
            "next_event": {
                "id": 7791,
                "date": "2016-08-27"
            }
        }
    },
    "headers": {
        "Content-type": "application/json"
    },
    "status": 200
}

 

REST API Clients Last updated: March 24, 2017

Published by MDJM

Posts by MDJM Visit Website

Post navigation

Previous

MDJM REST API: Endpoints

Next

MDJM REST API: Employee

Document Categories

  • Configuration
    • Advanced
  • Extensions
    • Dynamic Contact Forms
    • Google Calendar Sync
    • PayPal Standard
  • FAQs
  • Getting Started
  • Hooks
  • REST API

Latest Posts

  • PayPal Payment Method Discontinued
  • Enhancements! Enhancements! Enhancements!
  • Black Friday Offers
  • Stripe Payments Add-on

Social Links

  • Like our Facebook Page
  • Join our Facebook Group
  • Fork us on GitHub

Latest news & offers

Subscribe now to receive all the latest news, thoughts and offers from MDJM Event Management.
New subscribers will receive 15% off their first purchase.

© 2021 MDJM Event Management. All rights reserved.
  • Shop
  • Support
  • Account
  • Contact Us
  • Testimonials
  • Privacy Policy
  • Terms