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: Employee

MDJM REST API: Employee

Query employees via REST

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

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

Parameters

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

  • employee_id (Optional)
    The user ID of the employee you wish to retrieve.
  • employee_email (Optional)
    The email address of the employee you wish to retrieve.

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

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

  • ID (integer)
    The user ID of the employee
  • first_name (string)
    First name of employee
  • last_name (string)
    Last name of employee
  • email (string)
    Email address of employee
  • roles (array)
    An array of roles this employee has
  • last_login (date/time)
    The last date and time that the employee last logged in to MDJM
  • events (array)
    An array of the employees events stored within MDJM (Event ID => Event date)
  • next_event (array)
    An array containing the ID and date of the employee’s next event
  • total_events (integer)
    Total number of events this employee is assigned to (past and present)

Method

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

[heading element=”h3″ style=”bordered” remove_margins=”top,bottom”]Security[/heading]

The /employee/ 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 employee_id being specified is indeed that of n employee. If it is not, an error will be returned.

Example API Call

To retrieve information for the employee with user ID 84, the following would be used;

http://<yoursite.com>/wp-json/mdjm/v1/employee/?api_key=03e8d350690c06b6106edc7936bd2b96&token=b35b7c30f56e2975dcc7dc171db90cdb&employee_id=84

Response

The response from the above query would look like;

{
    "data": {
        "employee": {
            "first_name": "Employee",
            "last_name": "Three",
            "email": "[email protected]",
            "roles":  {
                "mdjm-accountant": "Accountant"
            },
            "last_login": "2016-04-29",
            "events": {
                "5636": "2016-10-29",
                "7983": "2016-05-29",
                "8154": "2016-09-23",
                "8181": "2016-05-27"
            },
            "next_event": {
                "id": 5636,
                "date": "2016-10-29"
            },
            "total_events": 4
        }
    },
    "headers": {
        "Content-type": "application/json"
    },
    "status": 200
}

 

REST API Employees Last updated: March 24, 2017

Published by MDJM

Posts by MDJM Visit Website

Post navigation

Previous

MDJM REST API: Client

Next

MDJM REST API: Availability

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