User

API for accessing and modifying user information.

Searching and Listing Users

The route for listing users is:

GET /users
API Call: Listing users
URL/usershttp://g8teway.com/api/v2/users
HTTP MethodGET
Request ParametersretOptional
Default: id, login.
Allowed: id, login, email
useridsOptional. List of user ids
loginsOptional. List of user logins

You would get the list of users like this:

$ curl 'http://g8teway.com/api/v2/users.json' -b mdi.cookie -c mdi.cookie
[{"user":
   {"id": 1,
    "login": "admin",
    "email": null}},
 {"user":
   {"id": 2,
    "login": "myUser",
    "email": "myUser@example.com"}}]

Getting User Information

You can then get extended information on one user with:

/users/:id [GET]

so the following command

$ curl 'http://g8teway.com/api/v2/users/2.json' -b mdi.cookie -c mdi.cookie

will return the something like this:

{"user":
  {"id": 2,
   "login": "myUser",
   "email": "myUser@example.com"}}

User Management

Depending on your administrative rights, you can update your (and maybe other) user information by POSTing to in a few different ways.

/users/:id [PUT]
API Call: Edit User
URL/users/:idhttp://g8teway.com/api/v2/users/:id
HTTP MethodPUT
Request ParametersemailOptional
passwordOptional. Change password
random_passwordOptional. Generate new password

Where the PUT values are of :

  • email
  • password
  • random_password

So, you could do this to update email address:

$ curl 'http://g8teway.com/api/v2/users/2.json' -F 'email=new@example.com' --request PUT -i
HTTP/1.1 200 OK
...
Status: 200
...

Note that password will be included in response if you have generated a random one :

$ curl 'http://g8teway.com/api/v2/users/2.json' -F 'random_password=true' --request PUT
HTTP/1.1 200 OK
...
Status: 200
...
{"password": "5xl3popW"}