Skip to content

Developers

How can we help you?

← Go back

User

Note: Only Mediagenix On-Demand accounts configured for User Permissions will expose users in the API.

A User represents a regular active Movida user, excluding API users.

This is how a user looks like:

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id type="integer">140</id>
  <short-name>John S</short-name>
  <full-name>John Smith</full-name>
  <user-type>owner</user-type>
  <avatar-color>red</avatar-color>
  <avatar-initials>JS</avatar-initials>
  <avatar-url nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/users/140"/>
</user>
{
  "resource_type": "user",
  "id": 140,
  "short_name": "John S",
  "full_name": "John Smith",
  "user_type": "owner",
  "avatar_color": "red",
  "avatar_initials": "JS",
  "avatar_url": null,
  "self_link": "https://movida.bebanjo.net/api/users/140"
}

The self link is pointing to the user itself, and it is a unique URL that will not change overtime.

Valid attributes

  • id (required): Mediagenix On-Demand internal identifier of the user.

  • short-name (optional): the short name of the user.

  • full-name (optional): the full name of the user.

  • user-type (required): the type of the user.

  • avatar-color (optional): the color for the default avatar image of the user. Possible values are “yellow”, “orange”, “red”, “pink”, “purple”, “aqua”, “blue” and “green”. When the avatar-color is present, the avatar-url will be empty.

  • avatar-initials (optional): initials for the avatar image of the user.

  • avatar-url (optional): the URL for the avatar image of the user. It can be an absolute or relative URL that represents the avatar of the user. When using a relative URL, the oauth provider host is preprended. When the avatar-url is present, the avatar-color will be empty.

Get a list of all users in the current account

Users are linked from the root of the API, through the link identified with the rel="users" attribute:

<?xml version="1.0" encoding="UTF-8"?>
<movida>
  <!-- ... -->
  <link rel="users" href="https://movida.bebanjo.net/api/users">
</movida>
{
  // ...
  "users_link": "https://movida.bebanjo.net/api/users",
  // ...
}

Following that link, we can fetch the list of users in the current account.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/users
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/users
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <total-entries>132</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/users?page=1"/>
  <link rel="prev" href="https://movida.bebanjo.net/api/users?page=3"/>
  <user>
    <id type="integer">137</id>
    <short-name>Mediagenix On-Demand<short-name>
    <full-name>Mediagenix On-Demand<full-name>
    <user-type>admin<user-type>
    <avatar-color>orange</avatar-color>
    <avatar-initials>BB</avatar-initials>
    <avatar-url nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/users/137"/>
  </user>
  <user>
    <id type="integer">140</id>
    <short-name>John S<short-name>
    <full-name>John Smith<full-name>
    <user-type>owner<user-type>
    <avatar-color>red</avatar-color>
    <avatar-initials>JS</avatar-initials>
    <avatar-url nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/users/140"/>
  </user>
  <!-- ... -->
<user>
{
  "total_entries": 132,
  "prev_link": "https://movida.bebanjo.net/api/users?page=1",
  "next_link": "https://movida.bebanjo.net/api/users?page=3",
  "entries": [
    {
      "resource_type": "user",
      "id": 137,
      "short_name": "Mediagenix On-Demand",
      "full_name": "Mediagenix On-Demand",
      "user_type": "admin",
      "avatar_color": "orange",
      "avatar_initials": "BB",
      "avatar_url": null,
      "self_link": "https://movida.bebanjo.net/api/users/137"
    },
    {
      "resource_type": "user",
      "id": 140,
      "short_name": "John S",
      "full_name": "John Smith",
      "user_type": "owner",
      "avatar_color": "red",
      "avatar_initials": "BB",
      "avatar_url": null,
      "self_link": "https://movida.bebanjo.net/api/users/140"
    },
    // ...
  ]
}

Note: This is a paginated resource. By default, only 50 users will be included in each page but you can override this default by using the per_page parameter described in the next section. The total-entries attribute will indicate the total number of entries and the links rel="next" and rel="prev" should be used to get the next and the previous pages.

You can filter the list of users returned using the following attributes:

  • per_page: Number of elements returned in each page. The maximum value allowed is 200 and the default is 50.

Get a single user given its URL

The self link of a user contains a URL that will allow us to fetch that individual user:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/users/123
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/users/123
<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id type="integer">140</id>
  <short-name>John S<short-name>
  <full-name>John Smith<full-name>
  <user-type>owner<user-type>
  <avatar-color>red</avatar-color>
  <avatar-initials>JS</avatar-initials>
  <avatar-url nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/users/140"/>
</user>
{
  "resource_type": "user",
  "id": 140,
  "short_name": "John S",
  "full_name": "John Smith",
  "user_type": "owner",
  "avatar_color": "red",
  "avatar_initials": "BB",
  "avatar_url": null,
  "self_link": "https://movida.bebanjo.net/api/users/140"
}