Developer API - Users

  1. User attributes
  2. List of all users
  3. Find a specific user
  4. Get the API Token of an specific user

User attributes

An user have the following attributes:

Name Type Description
id Integer Record ID
email String Account e-mail
name String User name
sign_in_count Integer Sign in count
last_sign_in_at String Timestamp of last session (ISO 8601)
last_sign_in_ip String IP address used on last sign in
time_zone String Time zone utilizado no CloudWalk Manager (padrão UTC)
updated_at String Timestamp in ISO 8601 format
created_at String Timestamp in ISO 8601 format

List of all users

Return an array with all users.

Method and URL format

GET https://api.cloudwalk.io/{version}/users?access_token={token}

Example of use

$ curl -X GET "https://api.cloudwalk.io/v1/users?access_token=$TOKEN"
require 'net/http'

token = 'API_TOKEN'

uri = URI("https://api.cloudwalk.io/v1/users?access_token=#{token}")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)

res = http.request(request)

puts "Response #{res.code} #{res.message}: #{res.body}"

Example of response

{
   "pagination":{
      "page":1,
      "total_pages":1,
      "entries":2,
      "total_entries":2
   },
   "users":[
      {
         "user":{
            "id":1,
            "email":"[email protected]",
            "name":"Clark Kent",
            "sign_in_count":4,
            "last_sign_in_at":"2015-01-29T17:42:26Z",
            "last_sign_in_ip":"127.0.0.1",
            "time_zone":"America/Chicago",
            "updated_at":"2015-01-30T15:02:49Z",
            "created_at":"2015-01-26T17:47:35Z"
         }
      },
      {
         "user":{
            "id":3,
            "email":"[email protected]",
            "name":"Bruce Wayne",
            "sign_in_count":1,
            "last_sign_in_at":"2015-01-30T15:06:06Z",
            "last_sign_in_ip":"127.0.0.1",
            "time_zone":"America/Chicago",
            "updated_at":"2015-01-30T15:06:37Z",
            "created_at":"2015-01-30T15:04:27Z"
         }
      }
   ]
}

Find a specific user

Return the details of a specific user.

Method and URL format

GET https://api.cloudwalk.io/{version}/users/{user_id}?access_token={token}

Example of use

$ curl -X GET "https://api.cloudwalk.io/v1/users/3?access_token=$TOKEN"
require 'net/http'

token = 'API_TOKEN'

uri = URI("https://api.cloudwalk.io/v1/users/3?access_token=#{token}")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)

res = http.request(request)

puts "Response #{res.code} #{res.message}: #{res.body}"

Example of response

{
  "user":{
    "id":3,
    "email":"[email protected]",
    "name":"Bruce Wayne",
    "sign_in_count":1,
    "last_sign_in_at":"2015-01-30T15:06:06Z",
    "last_sign_in_ip":"127.0.0.1",
    "time_zone":"America/Chicago",
    "updated_at":"2015-01-30T15:06:37Z",
    "created_at":"2015-01-30T15:04:27Z"
  }
}

Get the API Token of an specific user

It is possible to get the API Token of a specific user, through its email and password.

Method and URL format

POST https://api.cloudwalk.io/{version}/users/token

Example of use

$ curl -X POST "https://api.cloudwalk.io/v1/users/token" \
-d '{"email":"[email protected]","password":"batman"}'
require 'net/http'
require 'json'

payload = {
  "email" => "[email protected]",
  "password" => "batman"
}

uri = URI("https://api.cloudwalk.io/v1/users/token")

req = Net::HTTP::Post.new(uri.request_uri)

req['Content-Type'] = "application/json"

req.body = payload.to_json

res = Net::HTTP.start(uri.hostname, uri.port) { |http|
  http.request(req)
}

puts "Response #{res.code} #{res.message}: #{res.body}"

Example of response

[
  {
    "company_name":"Wayne Enterprises",
    "company_id":1,
    "api_token":"78562f2ba49ce71ae966f23922a7c3692e3b9ay2"
  }
]