Endpoints

Get User

GET /api/users/<user_email> HTTP/1.1

API Request Example

GET /api/users/bill.smith@company.com HTTP/1.1
Accept: application/json

API Sucessful Response Example

HTTP/1.1 200 OK
{
    "data": {
        "id": 1,
        "name": "Bill Smith",
        "email": "bill.smith@company.com",
        "type" : "registered"
        ...
    }
}

API Error Response Example - Missing or Invalid User

HTTP/1.1 200 OK
{
    "error": "Data not found."
}

Create User

POST /api/users HTTP/1.1

API Request Example

POST /api/users HTTP/1.1
Content-Type: application/json
Accept: application/json

{
    "name": "Bill Smith",
    "email": "bill.smith@company.com",
    "type" : "registered"
}

API Sucessful Response Example

HTTP/1.1 201 Created
{
    "data": {
        "id": 1,
        "name": "Bill Smith",
        "email": "bill.smith@company.com",
        "type" : "registered",
        ...
    }
}

email and type are required fields when creating a user.

API Error Response Example - Missing or invalid fields (email & type)

HTTP/1.1 422 Unprocessable Entity
{
    "message": "The given data was invalid.",
    "errors": {
        "email": ["The email field is required."],
        "type": ["The type field is required."]
    }
}

Update User

PATCH /api/users/<user_email> HTTP/1.1

API Request Example

PATCH /api/users/bill.smith@company.com HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "type": "subscriber"
}

PATCH requests, such as this, can be used to convert a registered user to a subscriber, and vice versa.

API Error Response Example - Missing or Invalid User

HTTP/1.1 200 OK
{
    "error": "Data not found."
}

Delete User

DELETE /api/users/<user_email> HTTP/1.1

API Request Example

DELETE /api/users/bill.smith@company.com HTTP/1.1

API Error Response Example - Missing or Invalid User

HTTP/1.1 200 OK
{
    "error": "Data not found."
}

Fields

These are the fileds that can be supplied when creating or updating a user.

Field Type Notes
name String Optional - Minimum 2 characters, Maximum 191 characters
email String (valid email address) Required for user creation.
type String (registered, subscriber) Required for user creation

Subresources

These sub-resources can (optionally) be returned when requesting a user resource.

  • conferences