This endpoint allows you to manage users.

Note: Any endpoint that begins with "/api/users/" (unless it's in the form "/api/users/me/") is accessible to admins only.

Common Error Codes:

  • 404 No Content - Package not found; returns an error object
  • 400 Bad Request - Request parameters are invalid; returns an error object
  • 500 HTTP Internal Server Error - Request is valid but the server encountered an error; returns an error object

Get all users

GET /api/users

Request Parameters

Parameter Name Required/Optional Format Default Value Description
account_activated optional boolean none User account is activated (true/false)
account_expires optional boolean none User account expires (true/false)
name optional string none Faspex username or email; filters results to only one user whose Faspex username (or email address, for external users) matches the name specified in the request

Example Usage with Optional Query Filter:

GET /api/users?name=faspex_user_1

Success Response Code

  • 200 OK - Returns an array of users (complete user records)

Example Response:

[
   {
      "account_activated": true,
      "account_expires": false,
      "admin": true,
      "can_send_to_all_faspex_users": true,
      "can_send_to_external_email": "yes",
      "created_at": "2015-07-20 18:49:47 -0400",
      "delete_packages_after_download": false,
      "description": null,
      "email": "admin@localhost.com",
      "first_name": "Admin",
      "id": "2",
      "name": "admin",
      "last_login_time": "2015/10/08 16:07:36 -0400",
      "last_name": "Admin",
      "updated_at": "2015/10/08 17:46:44 -0400",
      "uploads_allowed": true,
      "user_profile_data_attributes": [
         {
            "created_at": "2016/07/05 15:23:20 -0700",
            "id": 8,
            "updated_at": "2016/07/05 15:23:20 -0700",
            "user_id": 5,
            "user_profile_field_id": 1,
            "value": "Marketing",
            "user_profile_field_name": "Department"
         },
         "..."
      ]
   }
   {  another user  }, etc.
]

Create a New User

POST /api/users

This method creates a new Faspex user.

Example Request

{
    "account_activated": true,
    "account_expires": false,
    "admin": false,
    "can_send_to_all_faspex_users": true,
    "can_send_to_external_email": "yes",
    "delete_packages_after_download": false,
    "description": "Added from LDAP user ID#123456",
    "downloads_allowed": true,
    "email": "jdoe@company.com",
    "first_name": "John",
    "last_name": "Doe",
    "name": "jdoe",
    "uploads_allowed": true,
    “user_profile_data_attributes”: [
    	{
		“user_profile_field_id”: 5,
		“value”: “field value”
	}
    ]
} 

Success Response Code

  • 200 OK - Returns a complete added user record

Update an existing user

PUT /api/users/{id}

Example Request

{
    "account_activated": true,
    "account_expires": false,
    "admin": false,
    "can_send_to_all_faspex_users": true,
    "can_send_to_external_email": "yes",
    "delete_packages_after_download": false,
    "description": "Added from LDAP user ID#123456",
    "downloads_allowed": true,
    "email": "jdoe@company.com",
    "first_name": "John",
    "last_name": "Doe",
    "name": "jdoe",
    "uploads_allowed": true,
    “user_profile_data_attributes”: [
    	{
		“user_profile_field_id”: 5,
		“value”: “new value”
	}
    ]
} 

Response Codes

  • 201 Created - Returns a complete added user record

Deactivate an existing user

DELETE /api/users/{id}

This method deactivates the user's account without deleting it.

Query Parameters: none

Request Parameters

Parameter Name Required/Optional Format Default Value Description
id required string none User ID for user account to be deactivated

Success Response Code:

  • 204 No Response - Returns an empty response body
Video player

Video

×