Users: Swarm users

Get a list of users

Summary

Get a list of users.

GET /api/v11/users

Description

Returns a list of users in Swarm.

Parameters

Parameter Description Type Parameter Type Required

ids

An optional single string or an array of users to display. Omitting this parameter or passing an empty value shows all users.

string

query

No

ignoreExcludeList

Determines if the list of users has the user_exclude_list filter applied or not. Add the parameter to ignore the user_exclude_list filter.

boolean

query

No

Example usage

Get a list of users

curl -u "username:ticket" "https://myswarm-url/api/v11/users"

Swarm responds with all users in Swarm:

HTTP/1.1 200 OK
 
{
  "error": null,
  "messages": [],
  "data": {
    "users": [
      {
        "id": "bruno",
        "type": "standard",
        "email": "bruno@perforce.com",
        "update": "2013/10/11 21:05:15",
        "access": "2021/01/21 16:55:38",
        "fullName": "Bruno First",
        "jobView": null,
        "password": null,
        "authMethod": "perforce",
        "reviews": []
      },
        ...
        <other users formatted as above>
        ...
      }
    ]
  }
} 		

Fetch a specific user

To fetch details for bruno:

curl -u "username:ticket" "https://myswarm-url/api/v11/users?ids=bruno"

Swarm responds with:

HTTP/1.1 200 OK
 
{
  "error": null,
  "messages": [],
  "data": {
    "users": [
      {
        "id": "bruno",
        "type": "standard",
        "email": "bruno@perforce.com",
        "update": "2013/10/11 21:05:15",
        "access": "2021/01/21 16:55:38",
        "fullName": "Bruno First",
        "jobView": null,
        "password": null,
        "authMethod": "perforce",
        "reviews": []
      }
    ]
  }
} 		

Fetch a number of specific users

To fetch details for bruno and alice:

curl -u "username:ticket" "https://myswarm-url/api/v11/users?ids[]=bruno&ids[]=alice"

Swarm responds with:

HTTP/1.1 200 OK
 
{
  "error": null,
  "messages": [],
  "data": {
    "users": [
      {
        "id": "bruno",
        "type": "standard",
        "email": "bruno@perforce.com",
        "update": "2013/10/11 21:05:15",
        "access": "2021/01/21 16:55:38",
        "fullName": "Bruno First",
        "jobView": null,
        "password": null,
        "authMethod": "perforce",
        "reviews": []
      },
      {
        "user": "alice",
        "type": "standard",
        "email": "asmith@perforce.com",
        "update": "2018/09/11 18:17:14",
        "access": "2020/12/24 16:55:38",
        "fullName": "Alice Smith",
        "jobView": null,
        "password": null,
        "authMethod": "perforce",
        "reviews": []
      }
    ]
  }
} 		

If a request fails

<error code>:

    401 Incorrect or missing credentials

HTTP/1.1 <response error code>		

{
  "error": <error code>,
  "messages": [{
    "code" : "<code string>",
    "text" : "<error message>"
  }],
  "data" : null
} 

Get information for a specific user

Summary

Get information for a specific user.

GET /api/v11/users/{id}

Description

Returns information for a specific user in Swarm.

Parameters

Parameter Description Type Parameter Type Required

id

User ID

string

path

Yes

Example usage

Get information for a specific user

To fetch information for bruno:

curl -u "username:ticket" "https://myswarm-url/api/v11/users/bruno"

Swarm responds with:

HTTP/1.1 200 OK
 
{
  "error": null,
  "messages": [],
  "data": {
    "users": [
      {
        "id": "bruno",
        "type": "standard",
        "email": "bruno@perforce.com",
        "update": "2013/10/11 21:05:15",
        "access": "2021/01/21 16:55:38",
        "fullName": "Bruno First",
        "jobView": null,
        "password": null,
        "authMethod": "perforce",
        "reviews": []
      }
    ]
  }
} 		

If a request fails

<error code>:

  • 401 Incorrect or missing credentials
  • 404 User does not exist
HTTP/1.1 <response error code>		

{
  "error": <error code>,
  "messages": [{
    "code" : "<code string>",
    "text" : "<error message>"
  }],
  "data" : null
}