NAV Navbar
shell ruby

Introduction

Welcome to the Redii API! You can use our API to access Redii API endpoints, currently limited to a list of recent notifications for your Program.

We have language bindings in Shell and Ruby!

Authentication

Redii uses API keys(your_program_token) to allow access to the API. You can register a new API key by clicking ‘Create a new key' button in the AdminHub(Under setting tab, api sideBar), you can 'click and copy' the token, disable, activate or delete the token. you can generate multiple tokens for you program, only active status token would work for the Api.

Redii expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Token token=<your_program_token>

Recognition

Get Multipages Moments

To authorize for JSON format feed, use this code:

# With shell, you can just pass the correct header with each request to the endpoint
curl -H "Authorization: Token token=<your_program_token>" \
https://<your_program_subdomain>.redii.com/api/recognition/v1/moments?limit=10&page=1
uri = URI.parse("https://<your_program_subdomain>.redii.com/api/recognition/v1/moments?limit=10&page=1")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request['authorization'] = "Token token=#{your_program_token}"
response = http.request(request)
data = JSON.parse(response.body)

To authorize for RSS format feed, add this link to your rss reader:

https://x:<your_program_token>@<your_program_subdomain>.redii.com/api/recognition/v1/moments.rss 
or 
https://<your_program_subdomain>.redii.com/api/recognition/v1/moments.rss?token=<your_program_token>

The above command returns JSON structured like this:

{
  "moment_nominations": [
    {
      "state": "approved",
      "created_at": "2019-05-02T14:05:10.992+10:00",
      "updated_at": "2019-05-02T14:05:10.992+10:00",
      "approved_at": "2019-05-02T14:05:10.968+10:00",
      "award_text": "test award",
      "manager_names": "Alice Doe",
      "user_names": "John Doe",
      "likes_count": 0,
      "comments_count": 0,
      "links": {
        "likes": "https://my_program.redii.com/api/recognition/v1/moments/1/likes"
      },
      "by_user_id": 10,
      "award_id": 1,
      "by_user": {
        "id": 10,
        "name": "Kongs Doe",
        "staff_id": "6789",
        "preferred_name": "",
        "email": "kongs.doe@test.com",
        "manager_name": "",
        "department": "Development",
        "country": "Australia",
        "state_region": "New South Wales",
        "custom_1": "",
        "custom_2": "",
        "custom_3": "",
        "roles": "Employee, Manager"
      },
      "values": "Team Work",
      "award": {
        "id": 1,
        "name": "Thank you",
        "description": "Say Thank you"
      },
      "users": [
        {
          "id": 1,
          "name": "John Doe",
          "staff_id": "1234",
          "preferred_name": "",
          "email": "john.doe@example.com",
          "manager_name": "Kongs Doe",
          "department": "Development",
          "country": "Australia",
          "state_region": "New South Wales",
          "custom_1": "",
          "custom_2": "",
          "custom_3": "",
          "roles": "Employee"
        }
      ],
      "recognition_id": 1,
      "recognition_type": "Nomination",
      "points_value": "",
      "points_source": "Company Recognition Account",
      "approver_names": ""
    }
  ],
  "meta": {
    "limit": 10,
    "page": 1,
    "show_auto_awards": true,
    "total": 1,
    "total_pages": 1
  }
}

This endpoints retrieves (default of) the 10 most recent moments of recognition.

HTTP Request

GET https://<your_program_subdomain>.redii.com/api/recognition/v1/moments

Query Parameters

Parameter Default Description
limit 10 The number of results to return.
page 1 The page number of results to return.
show_auto_awards true Return all awards data including auto type if set to true, if set false awards with auto type will not return.

Get All likes for the specific moment

To authorize for JSON format feed, use this code:

# With shell, you can just pass the correct header with each request to the endpoint
curl -H "Authorization: Token token=<your_program_token>" \
https://<your_program_subdomain>.redii.com/api/recognition/v1/moments/<moment_id>/likes
uri = URI.parse("https://<your_program_subdomain>.redii.com/api/recognition/v1/moments/<moment_id>/likes")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request['authorization'] = "Token token=#{your_program_token}"
response = http.request(request)
data = JSON.parse(response.body)

To authorize for RSS format feed, add this link to your rss reader:

https://x:<your_program_token>@<your_program_subdomain>.redii.com/api/recognition/v1/moments/<moment_id>/likes.rss 
or 
https://<your_program_subdomain>.redii.com/api/recognition/v1/moments/<moment_id>/likes.rss?token=<your_program_token>

The above command returns JSON structured like this:

{
  "likes": [
    {
      "id": 1,
      "user": {
        "id": 1,
        "name": "John Doe",
        "staff_id": "1234",
        "preferred_name": "",
        "email": "john.doe@example.com",
        "manager_name": "",
        "department": "Development",
        "country": "Australia",
        "state_region": "New South Wales",
        "custom_1": "",
        "custom_2": "",
        "custom_3": "",
        "roles": "Employee"
      }
    }
  ]
}

This endpoint retrieves the like rescourse from the moments response.

HTTP Request

GET https://<your_program_subdomain>.redii.com/api/recognition/v1/moments/<moment_id>/likes

User Details

User Creation

Use this code for create new user:

uri = URI.parse("https://<your_program_subdomain>.redii.com/api/user/v1")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
params = {
  email: "john.doe@example.com",
  staff_id: "1234",
  first_name: "John",
  last_name: "Doe"
}
request['authorization'] = "Token token=#{your_program_token}"
request['Content-Type'] = "application/json"
request.body = params.to_json
response = http.request(request)
data = JSON.parse(response.body)
# With shell, you can just pass the correct header with each request to the endpoint
curl -H "Authorization: Token token=<your_program_token>" \
-d "email=john.doe@example.com&staff_id=1234&first_name=John&last_name=Doe" \
-X POST https://<your_program_subdomain>.redii.com/api/user/v1

The above command returns JSON structured like this:

{
    "id": 1,
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "preferred_name": null,
    "birth_date": null,
    "avatar": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm",
    "roles": [
        {
            "id": 2,
            "name": "Employee"
        }
    ],
    "title": null,
    "department": null,
    "staff_id": "1234",
    "parent_id": null,
    "work_anniversary": null,
    "name": "John Doe",
    "received_points": 500,
    "managerial_discretionary_points": 0,
    "personal_discretionary_points": 250,
    "state": "active",
    "links": {
        "avatar": {
            "default": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm"
        }
    },
    "custom_1": null,
    "custom_2": null,
    "custom_3": null
}

This endpoint is use for create a new user with parameters.

HTTP Request

POST https://<your_program_subdomain>.redii.com/api/user/v1

Parameters

Parameter Type Description
staff_id* text The ID of employee.
email* text The email of employee.
first_name* text The first name of employee.
last_name* text The last name of employee.
preferred_name text The preferred name of employee.
title text The title of employee.
birth_date date - (DD/MM/YYYY) The birth date of employee.
work_anniversary date - (DD/MM/YYYY) The work start date of employee.
department text The department of employee.
country text The country of employee from.
region text The region of employee from.
custom_1 text The custom field 1 of employee.
custom_2 text The custom field 2 of employee.
custom_3 text The custom field 3 of employee.

User Edit

Use this code to edit existing user:

uri = URI.parse("https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Put.new(uri.request_uri)
params = {
  title: "tester"
}
request['authorization'] = "Token token=#{your_program_token}"
request['Content-Type'] = "application/json"
request.body = params.to_json
response = http.request(request)
data = JSON.parse(response.body)
# With shell, you can just pass the correct header with each request to the endpoint
curl -H "Authorization: Token token=<your_program_token>" \
-d "title=tester" \
-X PUT https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>

The above command returns JSON structured like this:

{
    "id": 1,
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "preferred_name": null,
    "birth_date": null,
    "avatar": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm",
    "roles": [
        {
            "id": 2,
            "name": "Employee"
        }
    ],
    "title": "tester",
    "department": null,
    "staff_id": "1234",
    "parent_id": null,
    "work_anniversary": null,
    "name": "John Doe",
    "received_points": 500,
    "managerial_discretionary_points": 0,
    "personal_discretionary_points": 250,
    "state": "active",
    "links": {
        "avatar": {
            "default": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm"
        }
    },
    "custom_1": null,
    "custom_2": null,
    "custom_3": null
}

This endpoint is use for edit existing user with parameters.

HTTP Request

PUT https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>

Parameters

Parameter Type Description
email* text The email of employee.
first_name* text The first name of employee.
last_name* text The last name of employee.
preferred_name text The preferred name of employee.
title text The title of employee.
birth_date date - (DD/MM/YYYY) The birth date of employee.
work_anniversary date - (DD/MM/YYYY) The work start date of employee.
department text The department of employee.
country text The country of employee from.
region text The region of employee from.
custom_1 text The custom field 1 of employee.
custom_2 text The custom field 2 of employee.
custom_3 text The custom field 3 of employee.

Set User Status

Use this code to set user status:

uri = URI.parse("https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>/state")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Put.new(uri.request_uri)
params = {
  state: "deactivation requested"
}
request['authorization'] = "Token token=#{your_program_token}"
request['Content-Type'] = "application/json"
request.body = params.to_json
response = http.request(request)
data = JSON.parse(response.body)
# With shell, you can just pass the correct header with each request to the endpoint
curl -H "Authorization: Token token=<your_program_token>" \
-d "state=deactivation requested" \
-X PUT https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>/state

The above command returns JSON structured like this:

{
    "id": 1,
    "email": "john.doe@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "preferred_name": null,
    "birth_date": null,
    "avatar": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm",
    "roles": [
        {
            "id": 2,
            "name": "Employee"
        }
    ],
    "title": "tester",
    "department": null,
    "staff_id": "1234",
    "parent_id": null,
    "work_anniversary": null,
    "name": "John Doe",
    "received_points": 500,
    "managerial_discretionary_points": 0,
    "personal_discretionary_points": 250,
    "state": "deactivation_requested",
    "links": {
        "avatar": {
            "default": "//www.gravatar.com/avatar.php?gravatar_id=8eb1b522f60d11fa897de1dc6351b7e8&size=150px&default=mm"
        }
    },
    "custom_1": null,
    "custom_2": null,
    "custom_3": null
}

This endpoint is use for set status on existing user.

HTTP Request

PUT https://<your_program_subdomain>.redii.com/api/user/v1/<staff_id>/state

Parameters

Parameter Type Description
state* text - (active, deactivation requested, suspended) The current status of employee.

Errors

The Redii API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request was ... bad!
401 Unauthorized -- Your API key is incorrect
403 Forbidden -- The requested is hidden for administrators only
404 Not Found -- The specified resource could not be found
405 Method Not Allowed -- You tried to access a resource with an invalid method
406 Not Acceptable -- You requested a format that isn't json
410 Gone -- The resource requested has been removed from our servers
418 I'm a teapot
429 Too Many Requests -- Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.