NAV
http

Introduction

This is the documentation for the API of CompanyMood.

This API follows the JSONAPI specification but without hypermedia.

There are a lot of different libraries for all kinds of languages out there to consume JSON-API APIs.

API Request and Versions

GET / HTTP/1.1
Host: api.company-mood.com
Accept: application/vnd.company-mood-v2+json

You need to specify the API version you want use via the Accept header. (current version is v2)

Format

application/vnd.company-mood-v<VERSION>+json

Application Token

GET / HTTP/1.1
Host: api.company-mood.com
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

You need to send your application token with every request in the X-App-Token header.

Authentication

GET / HTTP/1.1
Host: api.company-mood.com
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406

For every authenticated request (all but /sessions, /oauth and /password-resets) you need to send the auth_token (see /sessions endpoint) in the Authorization header as a Bearer token.

Heartbeat

Get the heartbeat

GET /heartbeat HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

A heartbeat endpoint which return a 200 status if the API is operational.

Sessions

Create a new session

POST /sessions HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "sessions",
    "attributes": {
      "email": "valid@example.com",
      "password": "secret"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "1d7f7eea-b088-46dd-b29c-51ccfa4085e7",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "gender": "male",
      "email": "j.doe1@example.com",
      "locale": "de",
      "image_url": "https://gravatar.com/avatar/829afce351884fcde132544bf9686221",
      "role": "admin",
      "auth_token": "5c3dad26-31a4-4f6d-a799-b3cd9053dc83",
      "company_id": "8f40670c-9927-4712-979f-81a2fa4c7253",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "mood_review_snoozed_until": "2019-06-14T11:15:00.000Z",
      "weekly_status_notification_active": true,
      "current_tracking_time": "2019-06-20T11:00:00.000Z"
    }
  }
}

You can create a new session and get the auth_token and other important informations about the just logged in user by sending the email and password to this endpoint.

The returned role can be “admin”, “supervisor”, “employee” or “department_manager”.

POST Attributes

Parameter Description
email Email for session
password Password for session

Response Attributes

Parameter Description
firstname Firstname of the sessions user
lastname Lastname of the sessions user
email Email of the sessions user
gender The gender of the sessions user (male, female, divers)
locale Locale of the sessions user
image_url Url to the profile image of the sessions user
role Role of the sessions user (admin, department_manager or employee)
auth_token Auth token for users session, use this for further authorization on endpoints
company_id ID of the company, the user belongs to. null if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
mood_review_snoozed_until Returns a date time if the user snoozed the mood review form.
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
current_tracking_time The next tracking time when the user should be presented with the mood tracking form.

End session / logout

DELETE /sessions HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{ }
HTTP/1.1 200 OK
Content-Type: application/json

{ }

This will logout the user and regenerates the users api_access_token. To retrieve the new api_access_token you need to create a new user session using the create endpoint above.

Companies

Retrieve the company stats for given company id

Returns with an 401 if the user does not belong to the company or isn’t an admin of the company.

GET /company/{company_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "companies",
       "attributes": {
         "name": "CompanyMood",
         "anonymous_tracking": false,
         "certificate_active": true,
         "certificate_type": "green",
         "certificate_id": "3d34dbca-ed95-4341-ac59-b4577311784b",
         "created_at": "2015-03-13T11:46:40.196Z",
         "frequency_period": "months",
         "frequency_amount": 3,
         "mood_creation_notification_on": 4,
         "mood_creation_notification_on_hours": 9,
         "mood_creation_notification_on_weeks": 4,
         "mood_creation_reminder_on": 5,
         "mood_creation_reminder_on_hours": 17,
         "mood_creation_reminder_on_weeks": 2,
         "allow_anonymous_suggestions": true,
         "current_tracking_period_start": "2015-03-01",
         "current_tracking_period_end": "2015-03-31",
         "logo_url": "https://cdn.company-mood.com/companies/logos/f8fddbb8ad00bede48a5df91248ca067537a2b7a/main.png"
       }
     }
  ]
}

Response Attributes

Parameter Description
id id of the company
name name of the company
anonymous_tracking Does the company track anonymous?
certificate_active Is the companies certificate active?
certificate_type Certificate type [“green”, “gold”]
certificate_id The certificated UUID
created_at Timestamp of the company creation
frequency_period Tracking frequency period [“daily”, “weeks”, “months”]
frequency_amount Tracking frequency amount [1..3]
mood_creation_notification_on Weekday for mood creation (notification and creation forcing)
mood_creation_notification_on_hours Hour for the mood creation (notification and creation forcing)
mood_creation_notification_on_weeks Week for the mood creation (notification and creation forcing)
mood_creation_reminder_on Weekday for mood creation reminder notification
mood_creation_reminder_on_hours Hour for the mood creation reminder notification
mood_creation_reminder_on_weeks Week for the mood creation reminder notification
allow_anonymous_suggestions Is it allowed to create anonymous suggestions for this company? If false, all suggestions will be created with not_anonymous set to true.
current_tracking_period_start Date when the current tracking period starts
current_tracking_period_end Date when the current tracking period ends
logo_url The URL of the company logo. If no custom logo has been uploaded the returned value will be null

Update a company

PUT /companies/{company_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": [
     {
       "type": "companies",
       "attributes": {
         "name": "CompanyMood",
         "certificate_active": true,
         "frequency_period": "months",
         "frequency_amount": 3,
         "mood_creation_notification_on": 4,
         "mood_creation_notification_on_hours": 9,
         "mood_creation_notification_on_weeks": 4,
         "mood_creation_reminder_on": 5,
         "mood_creation_reminder_on_hours": 17,
         "mood_creation_reminder_on_weeks": 2,
         "allow_anonymous_suggestions": false
       }
     }
  ]
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "companies",
       "attributes": {
         "name": "CompanyMood",
         "anonymous_tracking": false,
         "certificate_active": true,
         "certificate_type": "green",
         "certificate_id": "3d34dbca-ed95-4341-ac59-b4577311784b",
         "created_at": "2015-03-13T11:46:40.196Z",
         "frequency_period": "months",
         "frequency_amount": 3,
         "mood_creation_notification_on": 4,
         "mood_creation_notification_on_hours": 9,
         "mood_creation_notification_on_weeks": 4,
         "mood_creation_reminder_on": 5,
         "mood_creation_reminder_on_hours": 17,
         "mood_creation_reminder_on_weeks": 2,
         "allow_anonymous_suggestions": false,
         "current_tracking_period_start": "2015-03-01",
         "current_tracking_period_end": "2015-03-31",
         "logo_url": "https://cdn.company-mood.com/companies/logos/f8fddbb8ad00bede48a5df91248ca067537a2b7a/main.png"
       }
     }
  ]
}

PUT Attributes

Parameter Description
name name of the company
certificate_active Is the companies certificate active?
frequency_period Tracking frequency period [“daily”
frequency_amount Tracking frequency amount [1..3]
mood_creation_notification_on Weekday for mood creation (notification and creation forcing)
mood_creation_notification_on_hours Hour for the mood creation (notification and creation forcing)
mood_creation_notification_on_weeks Week for the mood creation (notification and creation forcing)
mood_creation_reminder_on Weekday for mood creation reminder notification
mood_creation_reminder_on_hours Hour for the mood creation reminder notification
mood_creation_reminder_on_weeks Week for the mood creation reminder notification
allow_anonymous_suggestions Is it allowed to create anonymous suggestions for this company? If false, all suggestions will be created with not_anonymous set to true.

Response Attributes

Parameter Description
id id of the company
name name of the company
anonymous_tracking Does the company track anonymous?
certificate_active Is the companies certificate active?
certificate_type Certificate type [“green”
certificate_id The certificated UUID
created_at Timestamp of the company creation
frequency_period Tracking frequency period [“daily”
frequency_amount Tracking frequency amount [1..3]
mood_creation_notification_on Weekday for mood creation (notification and creation forcing)
mood_creation_notification_on_hours Hour for the mood creation (notification and creation forcing)
mood_creation_notification_on_weeks Week for the mood creation (notification and creation forcing)
mood_creation_reminder_on Weekday for mood creation reminder notification
mood_creation_reminder_on_hours Hour for the mood creation reminder notification
mood_creation_reminder_on_weeks Week for the mood creation reminder notification
allow_anonymous_suggestions Is it allowed to create anonymous suggestions for this company? If false, all suggestions will be created with not_anonymous set to true.
current_tracking_period_start Date when the current tracking period starts
current_tracking_period_end Date when the current tracking period ends
logo_url The URL of the company logo. If no custom logo has been uploaded the returned value will be null

CustomTags

Retrieve the tags pool for logged in user

Custom tags specify the tags you can use to describe your mood. Returns with an 401 if the user does not belong to a company.

GET /custom_tags HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "meta": {
    "include_archived": true
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "custom_tags",
       "attributes": {
         "name": "Workload",
         "archived": "false",
         "labels": {
           "de": "Auslastung",
           "en": "Workload",
           "fr": "Charge de travail",
           "es": "Carga de trabajo",
           "it": "Carico di lavoro",
           "nl": "Werkbelasting",
           "pl": "Obciążenie pracą",
           "pt": "Carga de trabalho",
           "ru": "Рабочая нагрузка"
         },
         "descriptions": {
           "de": "Auslastung",
           "en": "Workload",
           "fr": "Charge de travail",
           "es": "Carga de trabajo",
           "it": "Carico di lavoro",
           "nl": "Werkbelasting",
           "pl": "Obciążenie pracą",
           "pt": "Carga de trabalho",
           "ru": "Рабочая нагрузка"
         },
         "de_translation": "Auslastung",
         "en_translation": "Workload",
         "fr_translation": "Charge de travail"
       }
     },
     {
       "id": "c23e5e7d-162f-4fdc-9243-5e6349ce2bd1",
       "type": "custom_tags",
       "attributes": {
         "name": "Privat",
         "labels": {
           "de": "Privat",
           "en": "Private",
           "fr": "Privé",
           "es": null,
           "it": null,
           "nl": null,
           "pl": null,
           "pt": null,
           "ru": null
         },
         "descriptions": {
           "de": "Privat",
           "en": "Private",
           "fr": "Privé",
           "es": null,
           "it": null,
           "nl": null,
           "pl": null,
           "pt": null,
           "ru": null
         },
         "de_translation": "Privat",
         "en_translation": "Private",
         "fr_translation": "Privé"
       }
     },
     {
       "id": "a9767fd1-a187-40e2-954c-872cebff5e70",
       "type": "custom_tags",
       "attributes": {
         "name": "Management",
         "archived": "true",
         "labels": {
           "de": "Führungskräfte",
           "en": "Managers",
           "fr": "Managers / Responsables",
           "es": "personal directivo",
           "it": "Personale direttivo",
           "nl": "Leidinggevenden",
           "pl": "Menedżerowie",
           "pt": "Gerentes",
           "ru": "Менеджеры"
         },
         "descriptions": {
           "de": "Führungskräfte",
           "en": "Managers",
           "fr": "Managers / Responsables",
           "es": "personal directivo",
           "it": "Personale direttivo",
           "nl": "Leidinggevenden",
           "pl": "Menedżerowie",
           "pt": "Gerentes",
           "ru": "Менеджеры"
         },
         "de_translation": "Vorgesetzte",
         "en_translation": "Management",
         "fr_translation": "Responsables"
       }
     }
  ]
}

GET META Attributes

Paramteter Description
include_archived optional Should response include archived custom tags as well? (default: false)

Response Attributes

Paramteter Description
id id of the tag (used for custom_tag_ids in mood creation)
name name (DEPRECATED)
archived Is this custom tag available for usage or already archived
labels An object of translations of the custom tag name.
descriptions An object of translations of the custom tag description.
de_translation German translation of the tag (DEPRECATED)
en_translation English translation of the tag (DEPRECATED)
fr_translation English translation of the tag (DEPRECATED)

Comments (for chat)

Create a new comment for a discussion

POST /comments HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "comments",
    "attributes": {
      "discussion_id": "679c5ffb-2d81-4608-8c4d-0f373b6f1401",
      "comment": {
        "content": "Happy to hear from you."
      }
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "8437",
    "attributes": {
      "content": "Happy to hear from you.",
      "created_at": "10.09.2020",
      "author_name": "Anonym",
      "author_image": "assets/defaults/user/mini-avatar-287e30a2e7e10a75d7afc0731799d16a58ce47c07b14fb3e8af573b9dac8f0c4.png"
    },
    "type": "comments"
  }
}

POST Attributes

Parameter Description
discussion_id required Id of the discussion you want to post to
comment[content] required Comment you want to post

Response Attributes

Paramteter Description
id Id of the comment
content Content of the comment
created_at Creation date of the comment
author_name Name of the comments creator
author_image Image URL of the comments creator

Discussions

Retrieve the logged in users discussions

Discussions are the chats a user is participating in.

GET /discussions HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "relationships": {
        "discussable": {
          "data": {
            "id": "679c5ffb-2d81-4608-8c4d-0f373b6f1401",
            "type": "discussable"
          }
        }
      },
      "id": "d26e8fb7-0290-4573-bd8f-ffd8ec39c485",
      "attributes": {
        "unseen_comments_count": 0,
        "total_comments_count": 2,
        "last_comment_created_at": "2020-09-10",
        "last_comment": "I'm sorry. 😘",
        "sorting_score": 1599733045
      },
      "type": "discussions"
    },
    {
      "relationships": {
        "discussable": {
          "data": {
            "id": "83524eec-aa43-42c6-adba-74afa5f74b8d",
            "type": "discussable"
          }
        }
      },
      "id": "561d35fd-a97f-4270-951f-5c425393abe2",
      "attributes": {
        "unseen_comments_count": 1,
        "total_comments_count": 5,
        "last_comment_created_at": "2020-09-10",
        "last_comment": "🤩",
        "sorting_score": 1999734045
      },
      "type": "discussions"
    }
  ],
  "included": [
    {
      "id": "679c5ffb-2d81-4608-8c4d-0f373b6f1401",
      "attributes": {
        "feeling": "ok",
        "reason": "A bit rugh atm",
        "custom_tag_id": "0e7f695f-d4b1-41a3-9796-51e2c459b6db",
        "created_at": "2020-09-04",
        "user_name": "Walter Weber",
        "user_name_with_email": "Walter Weber (walter@company-mood.com)",
        "author_image": "https://cdn.company-mood.com/users/avatars/4faebf2cc1ed879d15f325a7b0dc74a7292c03e9/mini.jpg?1583853827",
        "department_name": "Development",
        "department_hirarchy": "IT > Development",
        "period_name": "CW 30/20"
      },
      "type": "discussable"
    },
    {
      "id": "83524eec-aa43-42c6-adba-74afa5f74b8d",
      "attributes": {
        "feeling": "satisfied",
        "reason": "Finished some nice features! ",
        "custom_tag_id": "0e7f695f-d4b1-41a3-9796-51e2c459b6db",
        "created_at": "2020-08-19",
        "user_name": "Anonymous",
        "user_name_with_email": "Anonymous",
        "author_image": "https://cdn.company-mood.com/users/avatars/4faebf2cc1ed879d15f325a7b0dc74a7292c03e9/mini.jpg?1583853827",
        "department_name": null,
        "department_hirarchy": null,
        "period_name": "CW 28/20"
      },
      "type": "discussable"
    }
  ]
}

Response Attributes

Paramteter Description
id id of the dicussion
relationships object with id and type of the discussable (the resource, the discussion is about)
unseen_comments_count Count of unseen comments
total_comments_count Count of total comments
last_comment_created_at Date of last comment
last_comment Last comment on the discussion
sorting_score Score used for sorting (unseen comments > new seen ones > old seen ones)

Included Attributes

Parameter Description
id Id of the discussed resource
feeling Felling key of the discussed resource
reason COntent of the discussed resource
custom_tag_id Id of the custom tags discussed resource
created_at Creation date of the discussed resource
user_name User name of the creator of the discussed resource
user_name_with_email User name of the creator of the discussed resource - with added email in ()
user_image User image url
department_name Department name (without hirarchy)
department_hirarchy Department name (with hirarchy)
period_name Name of the creation tracking period

Retrieve the data of a specific discussion including comments

Discussions are the chats a user is participating in.

GET /discussions/d26e8fb7-0290-4573-bd8f-ffd8ec39c485 HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "relationships": {
      "comments": {
        "data": [
          {
            "id": "8419",
            "type": "comments"
          },
          {
            "id": "8437",
            "type": "comments"
          }
        ]
      }
    },
    "id": "d26e8fb7-0290-4573-bd8f-ffd8ec39c485",
    "type": "discussions"
  },
  "included": [
    {
      "id": "8419",
      "attributes": {
        "content": "😢",
        "created_at": "09.09.2020",
        "author_name": "Markus Schwed",
        "author_name_with_email": "Markus Schwed (markus@company-mood.com)",
        "author_image": "https://cdn.company-mood.com/users/avatars/4faebf2cc1ed879d15f325a7b0dc74a7292c03e9/mini.jpg?1583853827"
      },
      "type": "comments"
    },
    {
      "id": "8437",
      "attributes": {
        "content": "I'm sorry. 😘",
        "created_at": "10.09.2020",
        "author_name": "Anonym",
        "author_name_with_email": "Anonym",
        "author_image": "assets/defaults/user/mini-avatar-287e30a2e7e10a75d7afc0731799d16a58ce47c07b14fb3e8af573b9dac8f0c4.png"
      },
      "type": "comments"
    }
  ]
}

Response Attributes

Paramteter Description
id id of the dicussion
relationships Object with the id and type of discussions comments

Included Attributes

Parameter Description
id Id of the comment
content Content of the comment
created_at Creation date of the comment
author_name Name of the comments creator
author_name_with_email Name of the comments creator - with added email in ()
author_image Image URL of the comments creator
author_is_current_user Boolean returns true if the current user is the comments author
sorting_score Score for sorting (the higher the score, the newer)

Departments

Retrieve the departments of the users company

Returns with an 401 if the user does not belong to a company or isn’t an admin of the company.

GET /departments HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "departments",
       "attributes": {
         "name": "Services",
         "breadcrumb": "Development > In House > Services"
       }
     },
     {
       "id": "a9767fd1-a187-40e2-954c-872cebff5e70",
       "type": "departments",
       "attributes": {
         "name": "Management",
         "breadcrumb": "Management"
       }
     }
  ]
}

Response Attributes

Paramteter Description
id id of the department
name name
breadcrumb All names in path to the department incl. it’s own

Create a new department

POST /departments HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "departments",
    "attributes": {
      "name": "Management",
      "description": "All managers",
      "parent_id": "a9767fd1-a187-40e2-954c-872cebff5e70"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "departments",
    "attributes": {
      "name": "Management",
      "desciption": "All managers",
      "breadcrumb": "Management",
      "parent_id": "a9767fd1-a187-40e2-954c-872cebff5e70"
    }
  }
}

POST Attributes

Paramteter Description
name required Name of the department
description optional Description of the department
parent_id optional UUID of the parent department

Response Attributes

Paramteter Description
name Name of the department
description Description of the department
parent_id UUID of the parent department
breadcrumb All names in path to the department incl. it’s own

Update an existing department

PUT /departments/{department_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "departments",
    "attributes": {
      "name": "Management",
      "description": "All managers",
      "parent_id": "a9767fd1-a187-40e2-954c-872cebff5e70"
    }
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "departments",
    "attributes": {
      "name": "Management",
      "desciption": "All managers",
      "breadcrumb": "Management",
      "parent_id": "a9767fd1-a187-40e2-954c-872cebff5e70"
    }
  }
}

PUT Attributes

Paramteter Description
name required Name of the department
description optional Description of the department
parent_id optional UUID of the parent department

Response Attributes

Paramteter Description
name Name of the department
description Description of the department
parent_id UUID of the parent department
breadcrumb All names in path to the department incl. it’s own

Delete a department

DELETE /departments/{department_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

Delete a specific department (by department_id in the URI)

Important!

The subdepartment children get added to the parent of this deleted department. If the deleted department is root, then rootify the orphan subdepartments.

EventPins

Retrieve the event_pins of the users company

Returns with an 401 if the user does not belong to a company.

GET /event_pins HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "event_pins",
       "attributes": {
         "name": "New office manager",
         "description": "The new office manager got employed.",
         "date": "2016-03-11",
         "visible_for_role": "employee",
         "department_ids": [
           "094822c8-d81f-4639-8197-9a586f10edcd"
         ]
       }
     },
     {
       "id": "a9767fd1-a187-40e2-954c-872cebff5e70",
       "type": "event_pins",
       "attributes": {
         "name": "Off-Site in Berlin",
         "description": "We spend a week in Berlin together.",
         "date": "2016-05-27",
         "visible_for_role": "department_manager",
         "department_ids": []
       }
     }
  ]
}

Response Attributes

Paramteter Description
id id of the department
name Name of the event pin
description Description of the event pin
department_ids Department ids for departments the event pin belong. Belongs to whole company if empty
date Date of the event pin
visible_for_role Shows what users should be able to see it.

Oauth

Sign in via google oauth2

POST /oauth/google_oauth2 HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "oauth",
    "attributes": {
      "id_token": "INSERT ID TOKEN HERE"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "1d7f7eea-b088-46dd-b29c-51ccfa4085e7",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "image_url": "https://gravatar.com/avatar/829afce351884fcde132544bf9686221",
      "role": "admin",
      "auth_token": "5c3dad26-31a4-4f6d-a799-b3cd9053dc83",
      "company_id": "8f40670c-9927-4712-979f-81a2fa4c7253",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true
    }
  }
}

You can create a new oauth session and get the auth_token and other important informations about the just logged in user by sending a id_token to this endpoint.

The returned role can be “admin”, “supervisor”, “employee” or “department_manager”.

POST Attributes

Paramteter Description
id_token Request this token from google auth api (see https://developers.google.com/identity/sign-in/web/sign-in)

Response Attributes

Paramteter Description
firstname Firstname of the sessions user.
lastname Lastname of the sessions user.
email Email of the sessions user.
locale Locale of the sessions user.
image_url Url to the profile image of the sessions user.
role Role of the sessions user (admin, supervisor, department_manager or employee).
auth_token Auth token for users session, use this for further authorization on endpoints.
company_id ID of the company, the user belongs to. Empty if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)

Sign in via Microsoft Azure oauth2

POST /oauth/azure_oauth2 HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "oauth",
    "attributes": {
      "id_token": "INSERT ID TOKEN HERE"
      // OR
      "access_token": "INSERT ACCESS TOKEN HERE"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "1d7f7eea-b088-46dd-b29c-51ccfa4085e7",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "image_url": "https://gravatar.com/avatar/829afce351884fcde132544bf9686221",
      "role": "admin",
      "auth_token": "5c3dad26-31a4-4f6d-a799-b3cd9053dc83",
      "company_id": "8f40670c-9927-4712-979f-81a2fa4c7253",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true
    }
  }
}

You can create a new oauth session and get the auth_token and other important informations about the just logged in user by sending a id_token to this endpoint.

The returned role can be “admin”, “supervisor”, “employee” or “department_manager”.

POST Attributes

We support those 2 token types for azure authentication via oauth2. Make sure to only send one of them rather than both in the same request.

Paramteter Description
id_token Request this token from azure auth api (see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-access-token)
access_token Request this token from google auth api (see https://developers.google.com/identity/sign-in/web/sign-in)

Response Attributes

Paramteter Description
firstname Firstname of the sessions user.
lastname Lastname of the sessions user.
email Email of the sessions user.
locale Locale of the sessions user.
image_url Url to the profile image of the sessions user.
role Role of the sessions user (admin, supervisor, department_manager or employee).
auth_token Auth token for users session, use this for further authorization on endpoints.
company_id ID of the company, the user belongs to. Empty if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)

Sign in via apple

POST /oauth/apple HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "oauth",
    "attributes": {
      "authorization_code": "authorizationCode from apple-service",
      "authorized_scopes":  "authorizedScopes from apple-service",
      "email":              "email from apple-service",
      "full_name":          "fullName from apple-service",
      "identity_token":     "identityToken from apple-service",
      "real_user_status":   "realUserStatus from apple-service",
      "state":              "state from apple-service",
      "user":               "user from apple-service"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "1d7f7eea-b088-46dd-b29c-51ccfa4085e7",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "image_url": "https://gravatar.com/avatar/829afce351884fcde132544bf9686221",
      "role": "admin",
      "auth_token": "5c3dad26-31a4-4f6d-a799-b3cd9053dc83",
      "company_id": "8f40670c-9927-4712-979f-81a2fa4c7253",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true
    }
  }
}

The returned role can be “admin”, “supervisor”, “employee” or “department_manager”.

POST Attributes

Paramteter Description
authorizationCode Get this from login with apples (using AppleAuthRequestResponse interface)
authorizedScopes Get this from login with apples (using AppleAuthRequestResponse interface)
email Get this from login with apples (using AppleAuthRequestResponse interface)
fullName Get this from login with apples (using AppleAuthRequestResponse interface)
identityToken Get this from login with apples (using AppleAuthRequestResponse interface)
realUserStatus Get this from login with apples (using AppleAuthRequestResponse interface)
state Get this from login with apples (using AppleAuthRequestResponse interface)
user Get this from login with apples (using AppleAuthRequestResponse interface)

Response Attributes

Paramteter Description
firstname Firstname of the sessions user.
lastname Lastname of the sessions user.
email Email of the sessions user.
locale Locale of the sessions user.
image_url Url to the profile image of the sessions user.
role Role of the sessions user (admin, supervisor, department_manager or employee).
auth_token Auth token for users session, use this for further authorization on endpoints.
company_id ID of the company, the user belongs to. Empty if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)

Moods

Retrieve moods of the logged in user

GET /moods HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "meta": {
    "from": "2015-01-30",
    "to": "2015-04-30",
    "device_uid": "xxxx-xxxx-xxxx"
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "meta": {
    "from": "2015-01-30",
    "to": "2015-04-30",
    "last_weeks_mood_id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b"
  },
  "data": [
     {
       "id": "094822c8-d81f-4639-8197-9a586f10edcd",
       "type": "moods",
       "attributes": {
         "rating": 100,
         "calendar_week": 46,
         "year": 2015,
         "reason": "It was pretty noisy this week",
         "reasonings": [],
         "feeling": "happy",
         "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
         "created_at": "2015-11-21T05:59:42.517Z"
       }
     },
     {
       "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
       "type": "moods",
       "attributes": {
         "rating": 75,
         "calendar_week": 47,
         "year": 2015,
         "reason": "Got a new place in the basement! :)",
         "reasonings": [
           {
             "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
             "feeling": "happy",
             "reason": "The reason for happy custom tag"
           }
         ],
         "feeling": "satisfied",
         "department_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
         "created_at": "2015-11-18T19:18:42.517Z"
       }
     }
  ]
}

Request the moods for the logged in user.

Possibility to filter the collection by from, to, all_in_company and deparment_idparameters.

GET META Attributes

Paramteter Description
from optional Date to limit the moods results (in ISO8601)
to optional Date to limit the moods results (in ISO8601)
all_in_company optional Return all moods of that company (true or false) - only works for company admins
department_id optional Return all moods of that department (true or false) - only works for company admins
device_uid optional If the user is authenticated by a QrCode, you can use the device_uid to retrieve only the devices moods

Response META Attributes

Paramteter Description
from Date to limit the moods results (in ISO8601)
to Date to limit the moods results (in ISO8601)
last_weeks_mood_id ID of the last weeks mood for given user (can be empty, means no mood given)

Response Attributes

Paramteter Description
rating Rating as a number between 0 - 100
calendar_week Calendar week of the mood
year Year of the mood
reason Optional given reason
reasonings list of reasonings as an array
reasonings[custom_tag_id] ID of the custom tag for the reasoning
reasonings[feeling] feeling for the reasoning
reasonings[reason] reason for the reasoning as a string
feeling Feeling of the mood (happy, satisfied, ok, unhappy, sad)
department_id The moods department id
created_at Date of the mood creation (in ISO8601)

Create a new mood for last week - For the authorized user

POST /moods HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "moods",
    "attributes": {
      "feeling": "happy",
      "reason": "Got a new place in the basement! :)",
      "tag_list": "Management",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ]
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "moods",
    "attributes": {
      "rating": 100,
      "calendar_week": 25,
      "year": 2015,
      "reason": "Got a new place in the basement! :)",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ],
      "feeling": "happy",
      "department_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
      "created_at": "2015-06-25T11:18:42.517Z"
    }
  }
}

Creates the mood for the latest calendar week.

You MUST provide a reason or at least one tag in the tag_list parameter.

POST Attributes

Parameter Description
feeling required Feeling of the mood can be (“sad”, “unhappy”, “ok”, “satisfied”, “happy”) - in rating it’s 0, 25, 50, 75, 100
reason optional Text reason for the mood
reasonings optional list of reasonings as an array
reasonings[custom_tag_id] required ID of the custom tag for the reasoning
reasonings[feeling] required feeling for the reasoning
reasonings[reason] optional reason for the reasoning as a string
device_uid optional DeviceUid of the device - only send this if the user is authenticated via QrCode

Response Attributes

Paramteter Description
rating Rating as a number between 0 - 100
calendar_week Calendar week of the mood
year Year of the mood
reason Optional given reason
reasonings list of reasonings as an array
reasonings[custom_tag_id] ID of the custom tag for the reasoning
reasonings[feeling] feeling for the reasoning
reasonings[reason] reason for the reasoning as a string
feeling Feeling of the mood (happy, satisfied, ok, unhappy, sad)
department_id The moods department id
created_at Date of the mood creation (in ISO8601)

Create a new mood for last week - For a terminal (no user get assigned)

POST /moods HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "moods",
    "attributes": {
      "feeling": "happy",
      "reason": "Got a new place in the basement! :)",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ],
      "terminal_spot_id": "0f4d29f7-34e0-4ce9-b985-a90cccbd9f86",
      "department_id": "f53ac2a2-2917-4b4a-84ac-8874f406dc97"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "moods",
    "attributes": {
      "rating": 100,
      "calendar_week": 25,
      "year": 2015,
      "reason": "Got a new place in the basement! :)",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ],
      "feeling": "happy",
      "department_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
      "created_at": "2015-06-25T11:18:42.517Z"
    }
  }
}

Creates the mood for the latest calendar week.

You MUST provide a reason or at least one tag in the tag_list parameter.

POST Attributes

Parameter Description
feeling required Feeling of the mood can be (“sad”, “unhappy”, “ok”, “satisfied”, “happy”) - in rating it’s 0, 25, 50, 75, 100
reason required Text reason for the mood
reasonings optional list of reasonings as an array
reasonings[custom_tag_id] required ID of the custom tag for the reasoning
reasonings[feeling] required feeling for the reasoning
reasonings[reason] optional reason for the reasoning as a string
terminal_spot_id required ID of the terminal spot for which you want to track the mood
department_id required ID of the department for which you want to track the terminals mood (need to be assigned to the particular terminal)

Response Attributes

Paramteter Description
rating Rating as a number between 0 - 100
calendar_week Calendar week of the mood
year Year of the mood
reason Optional given reason
reasonings list of reasonings as an array
reasonings[custom_tag_id] ID of the custom tag for the reasoning
reasonings[feeling] feeling for the reasoning
reasonings[reason] reason for the reasoning as a string
feeling Feeling of the mood (happy, satisfied, ok, unhappy, sad)
department_id The moods department id
created_at Date of the mood creation (in ISO8601)

Update a mood

PUT /moods/{mood_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "moods",
    "attributes": {
      "feeling": "satisfied",
      "reason": "Got a new place in the basement! :)",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ]
    }
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "moods",
    "attributes": {
      "rating": 75,
      "calendar_week": 25,
      "year": 2015,
      "reason": "Got a new place in the basement! :)",
      "reasonings": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "feeling": "happy",
          "reason": "The reason for happy custom tag"
        }
      ],
      "feeling": "satisfied",
      "department_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
      "created_at": "2015-06-25T11:18:42.517Z"
    }
  }
}

Update a specific mood (by mood_id in the URI)

You can only update the mood for last calendar week and if its creation (created_at) is not older than 24h.

You MUST provide a reason or at least one tag in the tag_list parameter.

PUT Attributes

Parameter Description
feeling required Feeling of the mood can be (“sad”, “unhappy”, “ok”, “satisfied”, “happy”) - in rating it’s 0, 25, 50, 75, 100
reason required Text reason for the mood
reasonings optional list of reasonings as an array
reasonings[custom_tag_id] required ID of the custom tag for the reasoning
reasonings[feeling] required feeling for the reasoning
reasonings[reason] optional reason for the reasoning as a string

Response Attributes

Paramteter Description
rating Rating as a number between 0 - 100
calendar_week Calendar week of the mood
year Year of the mood
reason Optional given reason
reasonings list of reasonings as an array
reasonings[custom_tag_id] ID of the custom tag for the reasoning
reasonings[feeling] feeling for the reasoning
reasonings[reason] reason for the reasoning as a string
feeling Feeling of the mood (happy, satisfied, ok, unhappy, sad)
department_id The moods department id
created_at Date of the mood creation (in ISO8601)

Delete a mood

DELETE /moods/{mood_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

Delete a specific mood (by mood_id in the URI)

You can only delete the mood for last calendar week.

Password reset

POST /password-resets HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "password-resets",
    "attributes": {
      "email": "valid@example.com"
    }
  }
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json

To start a reset password process you have to send a POST request with the user email address to this endpoint. If the request was successful, you’ll receive an email with a password reset link.

This endpoint does not require authentication with auth_token.

POST attributes

Parameter Description
email User email for whom the process will be started

Public Announcements

Get all public announcements

GET /public_announcements HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "type": "public-announcements",
      "attributes": {
        "creator_name": "Jovanni Williamson",
        "content": "Awesome public announcement",
        "task_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
        "own_reaction": "up",
        "reaction_counts": {
          "up": 15,
          "down": 2
        },
        "created_at": "2018-06-25T11:18:42.517Z"
      }
    },
    {
      "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "type": "public-announcements",
      "attributes": {
        "creator_name": "Sammy Nonetti",
        "content": "We created a survey for our upcoming team event. Please participate.",
        "task_id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
        "own_reaction": null,
        "reaction_counts": {
          "up": 8,
          "down": 1
        },
        "created_at": "2018-05-25T19:12:32.212Z"
      }
    }
  ]
}

Get all public announcements which are accessible by the current user.

Response Attributes

Paramteter Description
id ID of the public announcement.
creator_name Name of announcement creator.
content Content of the public announcement.
task_id ID of the associated Task.
own_reaction The reaction of the current user. Can be “up”, “down” or null.
reaction_counts An Object with details for “up” and “down” reactions.
reaction_counts[up] Amount of up votes.
reaction_counts[down] Amount of down votes.
created_at Date of the public announcement creation (in ISO8601)

Create announcement reaction

POST /public_announcements/f7559f2a-8f1c-461e-8a9b-7efea5564edb/reactions HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "public-announcements",
    "attributes": {
      "reaction": "down"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
    "type": "public-announcements",
    "attributes": {
      "creator_name": "Jovanni Williamson",
      "content": "Awesome public announcement",
      "task_id": "a9767fd1-a187-40e2-954c-872cebff5e70",
      "own_reaction": "down",
      "reaction_counts": {
        "up": 14,
        "down": 3
      },
      "created_at": "2018-06-25T11:18:42.517Z"
    }
  }
}

React on public announcements with an “up” or “down” vote.

POST attributes

Paramteter Description
reaction The reaction key. Can be “up” or “down”.

Response Attributes

Paramteter Description
id ID of the public announcement.
creator_name Name of announcement creator.
content Content of the public announcement.
task_id ID of the associated Task.
own_reaction The reaction of the current user. Can be “up”, “down” or null.
reaction_counts An Object with details for “up” and “down” reactions.
reaction_counts[up] Amount of up votes.
reaction_counts[down] Amount of down votes.
created_at Date of the public announcement creation (in ISO8601)

Reasonings (comments from all sources like moods, reasonings, suggestions)

Retrieve reasonings for given meta filters

GET /reasonings HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "meta": {
    "from": "2020-04-01",
    "to": "2020-05-31",
    "origin_type": "Company",
    "origin_id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "reasonings_feeling": "happy",
    "with_reason_only": "true"
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "meta": {
    "from": "2020-04-01",
    "to": "2020-05-31",
    "origin_type": "Company",
    "origin_id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "reasonings_feeling": "happy",
    "reasonings_custom_tag_id": null,
    "with_reason_only": true
  },
  "data": [
     {
       "id": "1763109913022098",
       "type": "reasoning-1583247555",
       "attributes": {
         "username":"Anonym",
         "email":null,
         "department_string":null,
         "custom_tags":["Health"],
         "custom_tag_label":"Health",
         "custom_tag_id":"5c8d26ee-3a0e-3c55-8281-7fu67ed069c5",
         "feeling_key":"happy",
         "rating":100,
         "period":"KW 21/20",
         "comment":"Finally great again... Cured that arrow to the knee! :)",
         "answered":false,
         "answers_count":0,
         "answers":[],
         "chat_allowed":false,
         "additional_export_information":null
       }
     }
  ]
}

Request the reasonings for the given meta filters.

GET META Attributes

Paramteter Description
origin_type required Class of the reasoning origin. [Company, Department]
origin_id required UUID of the requested origin.
from optional Date to limit the moods results (in ISO8601)
to optional Date to limit the moods results (in ISO8601)
reasonings_feeling optional Filter reasonings for a specific feeling key [sad, unhappy, ok, satisfied, happy, positive, negative]
reasonings_custom_tag_id optional Filter for a specific custom_tag
with_reason_only optional Return only reasonings with an existing comment

Response META Attributes

Paramteter Description
origin_type required Class of the reasoning origin. [Company, Department]
origin_id required UUID of the requested origin.
from optional Date to limit the moods results (in ISO8601)
to optional Date to limit the moods results (in ISO8601)
reasonings_feeling optional Filter reasonings for a specific feeling key [sad, unhappy, ok, satisfied, happy, positive, negative]
reasonings_custom_tag_id optional Filter for a specific custom_tag
with_reason_only optional Return only reasonings with an existing comment

Response Attributes

Paramteter Description
username Authors name (if transparent) otherwise “Anonym”
email Authors email (if transparent) otherwise null
department_string Department name, if anonymity rules allow it
custom_tags Array of translated custom tag labels
custom_tag_label Translated custom tag label
custom_tag_id Custom tag id
feeling_key Feeling key [sad, unhappy, ok, satisfied, happy, positive, negative]
rating Rating of the feeling [0, 25, 50, 75, 100]
period Period string
comment Given comment for the reasoning - can be null
answered Have this reasoning been answered? - Boolean
answers_count Count of given answers
answers Answers as an array
chat_allowed Specifies if chat/discussion is allowed
additional_export_information Additional export informations - if applied

Settings

Retrieve the current user settings

GET /settings HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "70d17931-a3f0-4aa3-b432-c46f4b763d4f",
    "type": "settings",
    "attributes": {
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true,
      "new_discussion_comment_email_notification_active": false,
      "locale": "de"
    }
  }
}

Response Attributes

Parameter Description
id Current user ID
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
new_discussion_comment_email_notification_active Will the user receive an email notification for new discussion comments
locale A string with the locale of the current user

Update current user settings

PUT /settings HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data": {
    "type": "settings",
    "attributes": {
      "mood_creation_notification_email_active": false,
      "mood_creation_reminder_email_active": false,
      "mood_creation_notification_push_notification_active": false,
      "mood_creation_reminder_push_notification_active": false,
      "weekly_status_notification_active": false,
      "new_discussion_comment_email_notification_active": false
      "locale": "en"
    }
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "70d17931-a3f0-4aa3-b432-c46f4b763d4f",
    "type": "settings",
    "attributes": {
      "mood_creation_notification_email_active": false,
      "mood_creation_reminder_email_active": false,
      "mood_creation_notification_push_notification_active": false,
      "mood_creation_reminder_push_notification_active": false,
      "weekly_status_notification_active": false,
      "new_discussion_comment_email_notification_active": false,
      "locale": "en"
    }
  }
}

PUT Attributes

Parameter Description
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
new_discussion_comment_email_notification_active Will the user receive an email notification for new discussion comments
locale A string with the new locale for the current user

Response Attributes

Parameter Description
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
new_discussion_comment_email_notification_active Will the user receive an email notification for new discussion comments
locale A string with the locale of the current user

Suggestions

Create suggestion

POST /suggestions HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "suggestions",
    "attributes": {
      "content": "Free coffee plz!",
      "feeling": "happy",
      "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "not_anonymous": false,
      "terminal_spot_id": "7842e27e-a6dc-4cb7-9818-42a507410b1d"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e23sed23-f27e-49b9-9f27-94dd3e2a296b",
    "type": "suggestions",
    "attributes": {
      "content": "Free coffee plz!",
      "feeling": "happy",
      "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "not_anonymous": false,
      "terminal_spot_id": "7842e27e-a6dc-4cb7-9818-42a507410b1d",
      "created_at": "2018-06-25T11:18:42.517Z"
  }
}

Creates a suggestion for the current user with the given details.

You MUST provide a feeling, content and a custom_tag. The suggestion will be anonymous by default if you don’t provide a not_anonymous parameter. If your company is setup to not allow anonymous suggestions it will be always true.

POST Attributes

Paramteter Description
content required The suggestion content.
feeling required Feeling of the suggestion can be (“sad”, “unhappy”, “ok”, “satisfied”, “happy”).
custom_tag_id required ID of the custom tag for the suggestion.
not_anonymous optional Create not anonymous suggestion. True or false. false by default if not given. Always true if company is setup to not allow anonymous suggestions.
terminal_spot_id optional ID of the terminal spot for the suggestion.

Response Attributes

Paramteter Description
content The suggestion content
feeling Feeling of the suggestion can be (“sad”, “unhappy”, “ok”, “satisfied”, “happy”)
custom_tag_id ID of the custom tag for the suggestion
not_anonymous Boolean value. Displays if suggestion is anonymous or not.
terminal_spot_id ID of the terminal spot for the suggestion.
created_at Date of the suggestion creation (in ISO8601)

Tasks

Get all tasks for current user

Get all tasks for the current user which are not archived.

GET /tasks HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "tasks",
       "attributes": {
         "name": "Implement CompanyMood",
         "description": "Implement continuous Mood monitoring",
         "percent": 100,
         "state": "implemented",
         "published": true,
         "created_at": "2018-03-11"
       }
     },
     {
       "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
       "type": "tasks",
       "attributes": {
         "name": "Teamevent",
         "description": "Big office party",
         "percent": 10,
         "state": "idea",
         "published": false,
         "created_at": "2018-03-15"
       }
     }
  ]
}

Response Attributes

Paramteter Description
id id of the task
name Name of the task
description Description of the task
percent Progress of the task in percent
state State of the task
published Did this task got published to all affected users?
created_at create at date of task

TerminalSpots

Retrieve the terminal spots of the users company

Returns with an 401 if the user does not belong to a company

You’ll need the terminal_spot_id and its associated department_id if you want to track a terminal mood. More under /moods

Note

In this endpoint you’ll get all dependend departments and terminal_spot_department_settings as sideloaded relationships and includes.

GET /terminal_spots HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [{
     "id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
     "type": "terminal_spot",
     "attributes": {
       "name": "Production exit terminal",
       "description": "This terminal gets placed at the facility A.1-5s exits",
       "soft_cap_rate": 10,
       "hard_cap_rate": 25,
       "mood_barometer_active": true,
       "suggestions_active": true,
       "surveys_active": true
     },
     "relationships": {
       "terminal_spot_department_settings": {
         "data": [
           {
             "id": "0cc30da9-ffc7-40ff-9c88-ef03aa692b98",
             "type": "terminal_spot_department_settings"
           }
         ]
       }
     }
   }],
   "included": [{
    "id": "0cc30da9-ffc7-40ff-9c88-ef03aa692b98",
    "type": "terminal_spot_department_settings",
    "attributes": {
      "users_count": 9,
      "department_id": "ea985df4-2c38-4c44-bda9-5bbe031f6755"
    },
    "relationships": {
      "department": {
        "data": {
          "id": "ea985df4-2c38-4c44-bda9-5bbe031f6755",
          "type": "departments"
        }
      }
    }
  },{
    "id": "ea985df4-2c38-4c44-bda9-5bbe031f6755",
    "type": "departments",
    "attributes": {
      "name": "Design",
      "breadcrumb": "German HQ > Development > Design"
    }
  }]
}

Response Attributes

terminal_spot

Paramteter Description
id id of the terminal spot
name name of the terminal spot
description description of the terminal spot
soft_cap_rate Soft cap rate defines at what rate (not amount) of overtracked moods, a warning should get shown fir a terminals department
hard_cap_rate Hard cap rate defines at what rate (not amount) of overtracked moods, a terminal should not allow the tracking for a terminals department
mood_barometer_active A boolean value which indicates if the mood review feature is active for this terminal spot.
suggestions_active A boolean value which indicates if the suggestion box feature is activated for this terminal spot.
surveys_active A boolean value which indicates if the survey feature is activated for this terminal spot.

side loaded department

Paramteter Description
id id of the terminal spot
name name of the terminal spot
breadcrumb All names in path to the department incl. it’s own

side loaded terminal_spot_department_settings

Paramteter Description
id id of the terminal spot
users_count how much users are supposed to track via this terminal_spot_department_setting
department_id department id for this terminal_spot_department_setting (needed for tracking terminal mood)

Users

Get current user

GET /users/current HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "1d7f7eea-b088-46dd-b29c-51ccfa4085e7",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "gender": "male",
      "email": "j.doe1@example.com",
      "locale": "de",
      "image_url": "https://gravatar.com/avatar/829afce351884fcde132544bf9686221",
      "role": "admin",
      "company_id": "8f40670c-9927-4712-979f-81a2fa4c7253",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "mood_review_snoozed_until": "2019-06-14T11:15:00.000Z",
      "current_tracking_time": "2019-06-20T11:00:00.000Z",
      "weekly_status_notification_active": true,
      "auth_token": "5c3dad26-31a4-4f6d-a799-b3cd9053dc83"
    }
  }
}

Returns the current user details.

Response Attributes

Parameter Description
firstname Firstname of the sessions user
lastname Lastname of the sessions user
gender The gender of the sessions user (male, female, divers)
email Email of the sessions user
locale Locale of the sessions user
image_url Url to the profile image of the sessions user
role Role of the sessions user (admin, supervisor, department_manager or employee)
company_id ID of the company, the user belongs to. null if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
mood_review_snoozed_until Returns a date time if the user snoozed the mood review form.
current_tracking_time The next tracking time when the user should be presented with the mood tracking form.
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
auth_token Auth token for users session, use this for further authorization on endpoints

Get users statistics

GET /users/statistics HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
X-App-Token: 27f51875-9a43-4d6c-a376-6368f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "meta": {
    "from": "2020-11-16",
    "to": "2020-12-27",
    "origin_type": "Company",
    "origin_id": "bc41eea0-1f87-4e07-8dda-6449430e7132"
  },
  "data": {
    "id": "users-statistics",
    "type": "users-statistics",
    "attributes": {
      "employees_amount": 4.0,
      "invitations_amount": 4.0,
      "terminal_users_amount": 10.0,
      "active_users_amount": 14.0,
      "users_total_amount": 18.0
    }
  }
}

GET META Attributes

Paramteter Description
from optional Date to limit the moods results (in ISO8601)
to optional Date to limit the moods results (in ISO8601)
origin_type optional Enum [“Company”, “Department”]
origin_id optional ID of the requested origin which stats are requested

Response META Attributes

Paramteter Description
from optional Date to limit the moods results (in ISO8601)
to optional Date to limit the moods results (in ISO8601)
origin_type optional Enum [“Company”, “Department”]
origin_id optional ID of the requested origin which stats are requested

Response Attributes

Paramteter Description
employees_amount Amount of the invitation accepted users
invitations_amount Amount of the not accepted invitations
terminal_users_amount Amount of the terminal users (set in terminals)
active_users_amount Amount of all participating users (employees + terminal)
users_total_amount Amount of all users combined

Create a new user

This will create a user in your company which is directly able to use oauth or use password reset to set a password.

If you want to invite a user to your company with invitation email and invitation completion form (where the user set the password etc) you need to use the users invite endpoint (see below)

POST /users HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true,
      "password": "kjnasdfkjnasdfkjnaaskjdfn",
      "password_confirmation": "kjnasdfkjnasdfkjnaaskjdfn"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true
    }
  }
}

POST Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)
password Password for the user (the user can change it later)
password_confirmation Password confirmation

Response Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
company_id ID of the company, the user belongs to. null if the user does’t belong to a company, yet.
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)

Invite a user

This will invite a user to your company account. The user will receive an email and can complete the registration with firstname, lastname and password setting there.

If you want to create direct usable user accounts with fix passwords, name, email etc please use the users create endpoint (see above)

POST /users/invitations HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
      "mood_creation_notification_email_active": true,
      "mood_creation_reminder_email_active": true,
      "mood_creation_notification_push_notification_active": true,
      "mood_creation_reminder_push_notification_active": true,
      "weekly_status_notification_active": true
    }
  }
}

POST Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.

Response Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.
mood_creation_notification_email_active Will the user receive notifications for mood reviews per email?
mood_creation_reminder_email_active Will the user receive reminder for mood reviews per email if he didn’t give an answer already?
mood_creation_notification_push_notification_active Will the user receive push notifications for mood reviews on mobile phones?
mood_creation_reminder_push_notification_active Will the user receive push notifications to remind him to answer the review question on mobile phone?
weekly_status_notification_active Will the user receive a weekly status report per mail? (Attribute is not present for users without a report role)

Update a user

POST /users HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "data" : {
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb"
    }
  }
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "data": {
    "id": "e96afc28-f27e-49b9-9f27-94dd3e2a296b",
    "type": "users",
    "attributes": {
      "firstname": "John",
      "lastname": "Doe",
      "email": "j.doe1@example.com",
      "locale": "de",
      "role": "admin",
      "department_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb"
    }
  }
}

Update Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.

Response Attributes

Parameter Description
firstname Firstname of the user
lastname Lastname of the user
email Email of the user
locale Locale of the user
role Role of the user (admin, supervisor, department_manager or employee)
department_id ID of the department, the user belongs to. null if the user doesn’t belong to a department.

Delete a user

DELETE /users/{user_id} HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

Delete a specific user (by user_id in the URI)

Widgets

Get all widgets

GET /widgets HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db

{
  "meta": {
    "type": "dashboard"
  }
}
HTTP/1.1 200 OK
Content-Type: application/json

{
  "meta": {
    "type": "dashboard"
  },
  "data": [
    {
      "id": "company-average-mood",
      "type": "widgets"
    },
    {
      "id": "company-participation",
      "type": "widgets"
    },
    {
      "id": "company-happiness-score",
      "type": "widgets"
    },
    {
      "id": "company-custom-tags",
      "type": "widgets"
    }
    ...
  ]
}

This endpoint returns a set of available widgets for the current user. The set of returned widgets depends on the role of the current user and the optional given type filter.

To get a list with all widgets just request /widgets. If you want to get a list of widgets for the dashboard just request /widgets with type filter.

You can use the returned id’s to request the data for specific widgets with a call to /widgets/:id.

GET META Attributes

Parameter Description
type optional Filter widgets by type

Available filter types

Response META Attributes

Parameter Description
type Type of returned widgets

Response Attributes

Parameter Description
id The widget identifier

Company Average Mood

GET /widgets/company-average-mood HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "company-average-mood",
    "type": "widgets",
    "attributes": {
      "data": [
        {
          "from": "2018-10-29",
          "to": "2018-11-04",
          "participation_ratio": 33,
          "happiness_score": 20
        },
        {
          "from": "2018-11-05",
          "to": "2018-11-11",
          "participation_ratio": 36,
          "happiness_score": 25
        },
        {
          "from": "2018-11-12",
          "to": "2018-11-18",
          "participation_ratio": null,
          "happiness_score": null
        },
        {
          "from": "2018-11-19",
          "to": "2018-11-25",
          "participation_ratio": 0,
          "happiness_score": 35
        }
      ]
    }
  }
}

This endpoint returns average mood details for the last four periods of the current users company.

Response Attributes

Parameter Description
from Start date of represented week
to End date of represented week
participation_ratio Employee participation ratio in percent. null if anonymity settings do not allow to show data.
happiness_score Average happiness score for the tracking period.null if anonymity settings do not allow to show data.

Department Average Mood

GET /widgets/department-average-mood HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "department-average-mood",
    "type": "widgets",
    "attributes": {
      "data": [
        {
          "from": "2018-10-29",
          "to": "2018-11-04",
          "participation_ratio": 33,
          "happiness_score": 20
        },
        {
          "from": "2018-11-05",
          "to": "2018-11-11",
          "participation_ratio": 36,
          "happiness_score": 25
        },
        {
          "from": "2018-11-12",
          "to": "2018-11-18",
          "participation_ratio": null,
          "happiness_score": null
        },
        {
          "from": "2018-11-19",
          "to": "2018-11-25",
          "participation_ratio": 38,
          "happiness_score": 35
        }
      ]
    }
  }
}

This endpoint returns average mood information for the last four periods of the current users department.

Response Attributes

Parameter Description
from Start date of represented week
to End date of represented week
participation_ratio Employee participation ratio in percent. null if anonymity settings do not allow to show data.
happiness_score Average happiness score for the tracking period.null if anonymity settings do not allow to show data.

Company happiness score

GET /widgets/company-happiness-score HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "company-happiness-score",
    "type": "widgets",
    "attributes": {
      "happiness_score": 20.3,
      "feeling": "ok"
    }
  }
}

This endpoint returns the happiness score widget information for the current period and current user company.

Response Attributes

Parameter Description
happiness_score Happiness score for the current tracking period and current user company.
feeling Can be ‘sad’, 'unhappy’, 'ok’, 'satisfied’ or 'happy’.

Department happiness score

GET /widgets/department-happiness-score HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "department-happiness-score",
    "type": "widgets",
    "attributes": {
      "happiness_score": 20.3,
      "feeling": "ok"
    }
  }
}

This endpoint returns the happiness score widget information for the current period and department of the current user.

Response Attributes

Parameter Description
happiness_score Happiness score for the current tracking period and current user department
feeling Can be 'sad’, 'unhappy’, 'ok’, 'satisfied’ or 'happy’.

Company participation

GET /widgets/company-participation HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "company-participation",
    "type": "widgets",
    "attributes": {
      "moods_count": 2,
      "employee_amount": 10,
      "participation_in_percent": 20,
      "moods_details": [
        { "feeling": "sad", "percent": 50, "count": 1 },
        { "feeling": "happy", "percent": 50, "count": 1 }
      ]
    }
  }
}

This endpoint returns participation statistics for the current users company and the current tracking period.

Response Attributes

Parameter Description
moods_count Amount of moods in current tracking period for current user company.
employee_amount Current user company total employee amount
participation_in_percent Participation in percent
moods_details An array of objects with details for each mood group.

Department participation

GET /widgets/department-participation HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "department-participation",
    "type": "widgets",
    "attributes": {
      "moods_count": 2,
      "employee_amount": 10,
      "participation_in_percent": 20,
      "moods_details": [
        { "feeling": "sad", "percent": 50, "count": 1 },
        { "feeling": "happy", "percent": 50, "count": 1 },
      ]
    }
  }
}

This endpoint returns participation statistics for the current users department and the current tracking period.

Response Attributes

Parameter Description
moods_count Amount of moods in current tracking period for current user department.
employee_amount Current user department total employee amount
participation_in_percent Participation in percent
moods_details An array of objects with details for each mood group

Company custom tags

GET /widgets/company-custom-tags HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "company-custom-tags",
    "type": "widgets",
    "attributes": {
      "total_moods_count": 2,
      "total_reasonings_count": 3,
      "custom_tag_details": [
        {
          "custom_tag_id": "7efea556-461e-8f1c-8a9b-f7559f2aedb",
          "reasonings_count": 2,
          "feeling_details": [
            { "name": "unhappy", "percent": 50.0, "reasonings_count": 1 },
            { "name": "sad", "percent": 50.0, "reasonings_count": 1 }
          ]
        },
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "reasonings_count": 1,
          "feeling_details": [
            { "name": "ok", "percent": 100.0, "reasonings_count": 1 },
          ]
        }
      ]
    }
  }
}

This endpoint returns the custom tag widget (Top X custom tags) data for the current user company and the current tracking period. The response doesn’t include custom tags or feelings where no moods has been given in the current tracking period. The custom_tag_details attribute will be an empty Array if no custom tag has any moods.

Response Attributes

Parameter Description
total_moods_count Total amount of moods in current tracking period for current user company.
total_reasonings_count Total amount of reasonings in current tracking period for current user company.
custom_tag_details An Array of objects with reasoning details for each custom tag.
custom_tag_details[custom_tag_id] ID of the custom tag.
custom_tag_details[reasonings_count] Amount of given reasonings for the custom tag.
custom_tag_details[feeling_details] An Array of objects with details for each feeling where moods exist.
custom_tag_details[feeling_details][name] The identifier of the feeling.
custom_tag_details[feeling_details][percent] Percentage of total given moods for the current custom tag.
custom_tag_details[feeling_details][reasonings_count] Amount of reasonings given for the current feeling and custom tag.

Department custom tags

GET /widgets/department-custom-tags HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "department-custom-tags",
    "type": "widgets",
    "attributes": {
      "total_moods_count": 5,
      "total_reasonings_count": 10,
      "custom_tag_details": [
        {
          "custom_tag_id": "f7559f2a-8f1c-461e-8a9b-7efea5564edb",
          "reasonings_count": 6,
          "feeling_details": [
            { "name": "ok", "percent": 50.0, "reasonings_count": 3 },
            { "name": "happy", "percent": 50.0, "reasonings_count": 3 }
          ]
        },
        {
          "custom_tag_id": "7efea556-461e-8f1c-8a9b-f7559f2aedb",
          "reasonings_count": 4,
          "feeling_details": [
            { "name": "sad", "percent": 50.0, "reasonings_count": 2 },
            { "name": "unhappy", "percent": 50.0, "reasonings_count": 2 }
          ]
        }
      ]
    }
  }
}

This endpoint returns the custom tag widget (Top X custom tags) data for the current user department and the current tracking period. The response doesn’t include custom tags or feelings where no moods has been given in the current tracking period.

Response Attributes

Parameter Description
total_moods_count Total amount of moods in current tracking period for current user department.
total_reasonings_count Total amount of reasonings in current tracking period for current user department.
custom_tag_details An Array of objects with mood details for each custom tag.
custom_tag_details[custom_tag_id] ID of the custom tag.
custom_tag_details[reasonings_count] Amount of given reasonings for the custom tag.
custom_tag_details[feeling_details] An Array of objects with details for each feeling where reasonings exist.
custom_tag_details[feeling_details][name] The identifier of the feeling.
custom_tag_details[feeling_details][percent] Percentage of total given reasonings for the current custom tag.
custom_tag_details[feeling_details][reasonings_count] Amount of reasonings given for the current feeling and custom tag.

Rankings

GET /widgets/rankings HTTP/1.1
Host: api.company-mood.com
Content-Type: application/json
Accept: application/vnd.company-mood-v2+json
Authorization: Bearer 795665b4-53da-468c-a0d7-ab2d82e58406
X-App-Token: 27f50875-9a43-4d6c-a376-6968f09858db
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "id": "rankings",
    "type": "widgets",
    "attributes": {
      "company_wide_ranking": 23,
      "company_employee_amount": 120,
      "department_wide_ranking": 12,
      "department_employee_amount": 30
    }
  }
}

The /widgets/rankings endpoint returns the ranking data for the current user.

Response Attributes

Parameter Description
company_wide_ranking Current user rank of all company employees. 0 if not available.
company_employee_amount Employee amount of current user company.
department_wide_ranking Current user rank of all. 0 if not available.
department_employee_amount Employee amount of current user department. 0 if not available.