Users

This page covers all API endpoints for users

Retrieve all users

GET https://wemx.app/api/v1/users

Returns a list of all users on your application

{
    "status": true,
    "current_page": 1,
    "data": [
        {
            "id": 913,
            "username": "blanca.oberbrunner",
            "email": "demetris.schultz@example.net",
            "first_name": "Rosalinda",
            "last_name": "Howe",
            "status": "active",
            "balance": 0,
            "avatar": null,
            "is_subscribed": 0,
            "visibility": "online",
            "language": "en",
            "data": null,
            "email_verified_at": "2024-01-08T19:06:37.000000Z",
            "last_seen_at": "2024-01-08T20:06:38.000000Z",
            "last_login_at": "2024-01-08T20:06:38.000000Z",
            "created_at": "2024-01-08T19:06:38.000000Z",
            "updated_at": "2024-01-08T19:06:38.000000Z"
        },
    ],
    "first_page_url": "http://wemx.app/api/v1/users?page=1",
    "from": 1,
    "last_page": 99,
    "last_page_url": "http://wemx.app/api/v1/users?page=99",
    "links": [
        {
            "url": null,
            "label": "Previous",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "...",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=98",
            "label": "98",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=99",
            "label": "99",
            "active": false
        },
        {
            "url": "http://wemx.app/api/v1/users?page=2",
            "label": "Next",
            "active": false
        }
    ],
    "next_page_url": "http://wemx.app/api/v1/users?page=2",
    "path": "http://wemx.app/api/v1/users",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 1473
}
```

Available Relationships (optional)

https://wemx.app/api/v1/users?include=address,orders,payments

Available relationships:

balance_transactions, notifications, punishments, permissions, affiliate, suborder, orders, payments, devices, address, groups, emails, oauth, ips

Filters (optional)

https://wemx.app/api/v1/users?filter[is_online]=1&filter[is_subscribed]=1

Available Filters:

first_name, last_name, username, email, is_subscribed, is_online, created_at

Sorting (optional)

https://wemx.app/api/v1/users?sort[balance]=asc

Available Sorting Parameters:

first_name, last_name, username, email, balance, created_at

Sorting operators

asc, desc, random

Dates (optional)

https://wemx.app/api/v1/users?date=30days

Create a user

POST https://wemx.app/api/v1/users

Create a user on your application

Path Parameters

{
    "success": true,
    "data": {
        "username": "johndoe",
        "email": "johndoe@example.com",
        "language": "en",
        "first_name": "John",
        "last_name": "Doe",
        "status": "active",
        "last_login_at": "2024-01-09T18:06:58.000000Z",
        "updated_at": "2024-01-09T18:06:58.000000Z",
        "created_at": "2024-01-09T18:06:58.000000Z",
        "id": 2389,
        "address": {
            "id": 2256,
            "user_id": 2389,
            "company_name": null,
            "address": null,
            "address_2": null,
            "country": null,
            "city": null,
            "region": null,
            "zip_code": null,
            "created_at": "2024-01-09T18:06:58.000000Z",
            "updated_at": "2024-01-09T18:06:58.000000Z"
        }
    }
}

Get current authenticated user

GET https://wemx.app/api/v1/users/auth

Returns the current user that is logged in

{
   "status":true,
   "data":{
      "id": 523,
      "username": "johnsmith_",
      "email": "johnsmith@example.com",
      "first_name": "John",
      "last_name": "Smith",
      "language": "en",
      "avatar": "https://wemx.app/storage/avatars/8BKePJmpruAE4OV0.png",
      "status": "active",
      "is_subscribed": false,
      "is_email_verified": true,
      "last_seen_at": "2024-01-31T13:46:41.000000Z",
      "last_login_at": "2024-01-20T22:38:22.000000Z",
      "created_at": "2023-12-12T14:06:33.000000Z"
   }
}

Retrieve a user from id

GET https://wemx.app/api/v1/users/{user}

Returns a user from id

Query Parameters

{
    "status": true,
    "data": {
        "id": 913,
        "username": "blanca.oberbrunner",
        "email": "demetris.schultz@example.net",
        "first_name": "Rosalinda",
        "last_name": "Howe",
        "status": "active",
        "balance": 0,
        "avatar": null,
        "is_subscribed": 0,
        "visibility": "online",
        "language": "en",
        "data": null,
        "email_verified_at": "2024-01-08T19:06:37.000000Z",
        "last_seen_at": "2024-01-08T20:06:38.000000Z",
        "last_login_at": "2024-01-08T20:06:38.000000Z",
        "created_at": "2024-01-08T19:06:38.000000Z",
        "updated_at": "2024-01-08T19:06:38.000000Z"
    }
}

Update user details

PUT https://wemx.app/api/v1/users/{user}

Update a users information, only values that are passed in the body are updated, the remaining values remain as default if they are not specified.

Request Body

{
    "success": true,
    "data": {
        "id": 2389,
        "username": "johndoe",
        "email": "johndoe@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "status": "active",
        "balance": 0,
        "avatar": null,
        "is_subscribed": 0,
        "visibility": "online",
        "language": "en",
        "data": null,
        "email_verified_at": null,
        "last_seen_at": "2024-01-09T19:06:58.000000Z",
        "last_login_at": "2024-01-09T18:06:58.000000Z",
        "created_at": "2024-01-09T18:06:58.000000Z",
        "updated_at": "2024-01-09T18:06:58.000000Z"
    }
}

Delete a user

DELETE https://wemx.app/api/v1/users/{user}

Delete a user permanently from your application. The user cannot have any active, or suspended orders and must not have any punishments on record.

Request Body

{
    "success": true,
    "message": "User deleted successfully"
}

Retrieve orders for a user

GET https://wemx.app/api/v1/users/{user}/orders

Returns all orders the user owns

Retrieve payments for a user

GET https://wemx.app/api/v1/users/{user}/payments

Returns all payments the user has made

Update user balance

PUT https://wemx.app/api/v1/users/{user}/update-balance

Update a users balance

Path Parameters

{
    "success": true,
    "message": "Balance updated successfully"
}

Send a user an email

POST https://wemx.app/api/v1/users/{user}/send-email

Email the user through your application

Path Parameters

{
    "success": true,
    "message": "Email sent successfully"
}

Notify a user

POST https://wemx.app/api/v1/users/{user}/send-notification

Send a notification to the user

Path Parameters

{
    "success": true,
    "message": "Notification sent successfully"
}

Last updated