EMS Users Resource

From RAD Studio
Jump to: navigation, search

Go Up to EMS Administrative API


The EMS database stores data about the registered users of your application. You can access this information by using the registered Users Resource.

Note: Use the TEMSClientAPI, the TBackendUsers or the TBackendAuth components to sign up, log in, retrieve, update, or delete EMS Users information from your EMS Database.

Users Resource Endpoints

Users Resource exposes the following EMS Resource Endpoints:

Endpoint Method Name Resource Suffix HTTP Request Type Use

GetUsers

--

HTTP GET

To retrieve all data from a Users Resource.

GetUser

{id}

HTTP GET

To retrieve all data from a User.
id is the unique EMS User identifier (UserID) in the EMS database.

GetUserFields

fields

HTTP GET

To retrieve all the field names of the EMS Users (including the custom fields).

GetUserGroups

{id}/groups

HTTP GET

To retrieve the EMS Groups the EMS User belongs to.
id is the unique EMS User identifier (UserID) in the EMS database.

SignupUser

--

HTTP POST

Signs up to the EMS Server with an appropriate EMS User.

LoginUser

--

HTTP POST

Logs in to the EMS Server with a specific EMS User.

AddUser

--

HTTP POST

To add a new User to the EMS database.

UpdateUser

{id}

HTTP PUT

To update a User from the Users resource.
id is the unique EMS User identifier (UserID) in the EMS database.

DeleteUser

{id}

HTTP DELETE

To delete an item from a resource.
id is the unique EMS User identifier (UserID) in the EMS database.

Note: _id corresponds to the EMS User identifier in the EMS database (UserID).

GetUsers Endpoint

Returns a list of EMS User data.

If successful, the response from the EMS server provides a list of all EMS Users with details about each one of them.

  • username
  • _id (UserID)
  • _meta (the creator, created, and updated fields)
  • Custom fields (Optional)

Use the QueryUsers method, the TBackendUsers component or the TBackendQuery component and the Users resource to retrieve the list of EMS Users.

Example Response

This is an example response:

[
    {
        "username": "test",
        "_id": "24EDA495-90FC-4BC4-9626-C87783357948",
        "_meta": {
            "creator": "24EDA495-90FC-4BC4-9626-C87783357948",
            "created": "2014-08-20T11:08:55.000Z"
        },
        "description": "Created by EMS setup.  Password is \"test\"."
    },
    {
        "username": "testuser",
        "_id": "AB4900CC-CD7A-4890-B20D-9A3E65B450C7",
        "_meta": {
            "creator": "24EDA495-90FC-4BC4-9626-C87783357948",
            "created": "2014-08-20T11:08:55.000Z",
            "updated": "2014-08-20T11:08:59.000Z"
        }
    }
]

GetUser Endpoint

Returns the data for a specific EMS User (identified by the id).

Your request must provide the following field:

  • _id (UserID)

If successful, the response from the EMS server provides EMS Users with the following details:

  • username
  • _id (UserID)
  • _meta (the creator, created, and updated fields)
  • Custom fields (Optional)

Use the RetrieveUser method, the TBackendUsers component or the TBackendQuery component and a specific user to retrieve its data.

Example Response

This is an example response to request for user "82C6E6C0-A4BC-44B8-9434-A07DCE364CD4":

{
    "username": "test",
    "_id": "82C6E6C0-A4BC-44B8-9434-A07DCE364CD4",
    "_meta": {
        "creator": "82C6E6C0-A4BC-44B8-9434-A07DCE364CD4",
        "created": "2014-08-20T09:51:10.000Z"
    },
    "description": "Created by EMS setup.  Password is \"test\"."
}

GetFields Endpoint

Retrieves all the field names of the EMS Users (including all the custom fields).

If successful, the response from the EMS server provides EMS Users with (at least) the following details:

  • username
  • _id (UserID)
  • _meta (the creator, created, and updated fields)
  • Custom fields (Optional)

Use the RetrieveUsersFields method to retrieve all the field names.

Example Response

This is an example response:

[  
   {  
      "name":"username"
   },
   {  
      "name":"_id"
   },
   {  
      "name":"_meta",
      "fields":[  
         {  
            "name":"creator"
         },
         {  
            "name":"created"
         },
         {  
            "name":"updated"
         }
      ]
   },
   {  
      "name":"description",
      "custom":true
   }
]

GetUserGroups Endpoint

Retrieves the EMS Groups the EMS User (identified by the id) belongs to.

Your request must provide the following field:

  • _id (UserID)

If successful, the response from the EMS server provides the list of the EMS Groups names the EMS User belongs to.

Use the RetrieveUserGroups method to retrieve the list of EMS Groups the user belongs to.

Example Response

This is an example response to request for user "AB5D4B63-79F9-40A4-A34D-4D2D26ECF170":

[  
   "testgroup",
   "Admins"
]

SignupUser Endpoint

Signs up to the EMS Server with an appropriate EMS User.

Your request must provide the following fields:

  • username
  • password

Use the SignupUser method of TEMSClientAPI or the Signup method of TBackendAuth component to sign up a new EMS User in the EMS Server.

LoginUser Endpoint

Logs in to the EMS Server with a specific EMS User.

Your request must provide the following fields:

  • username
  • password

Use the LoginUser method of TEMSClientAPI or the Login method of TBackendAuth component to log in with an existing EMS User in the EMS Server.

AddUser Endpoint

Adds a new EMS User to the EMS database.

Your request must provide the following fields:

  • username
  • password

Use the AddUser method or the CreateUserAPI method of TBackendUsers component to add new EMS Users.

UpdateUser Endpoint

Updates the information that is stored in the EMS database for a specific EMS User (identified by the id).

Your request must provide the following fields:

  • _id (UserID)
  • Custom fields to update

Use the UpdateUser method or the UpdateUserDetails method of TBackendAuth component to update custom fields for an existing EMS User.

DeleteUser Endpoint

Deletes the EMS User with the specified id.

Your request must provide the following field:

  • _id (UserID)

Use the DeleteUser method or the DeleteUser method of TBackendUsers component to delete an EMS User.

EMS Users Fields

Users resource in EMS request and responses may include any combination of the following fields:

Item Example Description
"username"
"testuser"

EMS User name in the EMS database

"_id"
"AB4900CC-CD7A-4890-B20D-9A3E65B450C7"

Unique identifier of an EMS User (UserID) in the EMS database

"meta"
{
      "creator": "24EDA495-90FC-4BC4-9626-C87783357948",
      "created": "2014-08-20T11:08:55.000Z",
      "updated": "2014-08-20T11:08:59.000Z"
}
  • creator: EMS User creator in the EMS database.
  • created: Creation time of the EMS User.
  • updated: Time when the EMS User has been updated.

Custom fields

"myCustomField": "My Custom Field description"

Additional stored information for the EMS User

See Also