-
Notifications
You must be signed in to change notification settings - Fork 7
API documentation
- 401: Invalid token (Unauthorised)
- 403: Access error
- 400: Validation error
- 422: Unprocessable entity
- 500: Internal server error
- 201: Status created (POST Requests)
- 200: Status ok
{
error: {
code: "invalid_data"
message: "Please provide valid form data"
fields: {
"field_name": "Error message",
"field_name": "Error message"
}
}
}
Note: fields
section in error response will be present only when token is valid and there are form validation errors
{
"Content-Type": "application/json",
"Accept": "application/vnd.peerly.v1",
"Authorization": `Bearer ${apiToken}`
}
POST /oauth/google
access_token: "" (required)
Note: Validation must be present to check if signin email used for login belongs to valid organisation domain
Status code: 200 (ok)
{
data: {
token: <string>
}
}
### Claims inside JWT token:
iss: "node.peerly.com"
sub: <user-id> or <uuid> to uniquely identify a user
aud: <base url of react ui> (for now it can be "peerly.com")
exp: epoch (seconds) - on or after which it will not be accepted
nbf: epoch (seconds) - token older than this time won't be accepted
iat: epoch (seconds) - time of issuing the token
"https://peerly.com": {
"roleId": <role-id>,
"orgId": <org-id>,
"orgName": "<name of org>"
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 500 (InternalServerError)
{
"error": {
message: "internal server error"
}
}
POST /logout
Status code: 200 (ok)
Status Code: 500 (InternalServerError)
{
"error": {
message: "internal server error"
}
}
POST /core_values
"description": "" (required)
"text": "" (required)
"parent_core_value_id": null (optional)
Status code: 201 (created)
{
data: {
"id": <id>,
"description": <description>,
"text": <core_value_text>,
"parent_core_value_id": <parent_id> (default null)
"org_id": <organisation_id>
}
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
Status Code: 400 (Invalid request)
{
error: {
code: "invalid_data"
message: "Invalid core value data"
fields: {
"field_name": "Error message",
"field_name": "Error message"
}
}
}
PUT /core_values/:id
"description": "" (required)
"text": "" (required)
Status code: 200 (ok)
{
data: {
"id": <id>
"description": <description>
"text": <core_value_text>,
"parent_core_value_id": <parent_id>
"org_id": <organisation_id>
}
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
Status Code: 400 (Invalid request)
{
error: {
code: "invalid_data"
message: "Invalid core value data"
fields: {
"field_name": "Error message",
"field_name": "Error message"
}
}
}
GET /core_values
Status code: 200 (ok)
{
data: [{
"id":<id>
"description": <description>
"text": <core_value_text>,
"parent_core_value_id": <parent_id>
"org_id": <organisation_id>
}.
{
"id":<id>
"description": <description>
"text": <core_value_text>,
"parent_core_value_id": <parent_id>
"org_id": <organisation_id>
}]
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
GET /core_values/:id
Status code: 200 (ok)
{
data: {
"id":<id>
"description": <description>
"text": <core_value_text>,
"parent_core_value_id": <parent_id>
"org_id": <organisation_id>
}
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
GET /users
- limit (optional)
- offset (optional)
- starts_with (optional) search by text
- org_id (optional only for super admin access)
Status code: 200 (ok)
{
data: [{
"id":<id>
"first_name": <first_name>
"last_name": <last_name>
"email": <email>,
"display_name": <display_name>
"profile_image_url": <profile_image_url>
"role_id": <role_id>
"hi5_quota_balance":<hi5_quota_balance>
"org_id": <organisation_id>
"soft_delete_by": <user_id>
"soft_delete_at": <timestamp>
}.
{
"id":<id>
"first_name": <first_name>
"last_name": <last_name>
"email": <email>,
"display_name": <display_name>
"profile_image_url": <profile_image_url>
"role_id": <role_id>
"hi5_quota_balance":<hi5_quota_balance>
"org_id": <organisation_id>
"soft_delete_by": <user_id>
"soft_delete_at": <timestamp>
}]
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
GET /users/:id
Status code: 200 (ok)
{
data: {
"id":<id>
"first_name": <first_name>
"last_name": <last_name>
"email": <email>,
"display_name": <display_name>
"profile_image_url": <profile_image_url>
"role_id": <role_id>
"hi5_quota_balance":<hi5_quota_balance>
"org_id": <organisation_id>
}
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
PUT /users/:id
"first_name": <first_name> (required)
"last_name": <last_name> (required)
"display_name": <display_name> (required)
"profile_image_url": <profile_image_url> (optional)
Status code: 200 (ok)
{
data: {
"id":<id>
"first_name": <first_name>
"last_name": <last_name>
"email": <email>,
"display_name": <display_name>
"profile_image_url": <profile_image_url>
"role_id": <role_id>
"hi5_quota_balance":<hi5_quota_balance>
"org_id": <organisation_id>
}
}
Note: No POST API for users they will be created by login
GET /recognitions
- given_by (optional)
- given_for (optional)
- core_value_id (optional)
- limit (optional)
- offset (optional)
Status code: 200 (ok)
{
data: [{
"id":<id>
"core_values_id": <core_value_id>
"text": <recognition_text>,
"given_for": <user_id>
"given_by": <user_id>
"given_at": <timestamp>
}.
{
"id":<id>
"core_values_id": <core_value_id>
"text": <recognition_text>,
"given_for": <user_id>
"given_by": <user_id>
"given_at": <timestamp>
}]
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
POST /recognitions
- given_for (required)
- core_value_id (required)
- text (required)
Status code: 201 (created)
{
data: {
"id":<id>
"core_values_id": <core_value_id>
"text": <recognition_text>,
"given_for": <user_id>
"given_by": <user_id>
"given_at": <timestamp>
}
}
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
POST /recognitions/:recognition_id/hi5
- comment (optional)
Status code: 201 (created)
Status Code: 401 (Unauthorized)
{
"error": {
code: "invalid_token"
message: "unauthorized user"
}
}
Status Code: 403 (forbidden)
{
"error": {
code: "access_denied"
message: "Permission required"
}
}
Status Code: 400
{
"error": {
code: "insufficient_hi5_balance"
message: "Hi5 quota balance is insufficient for this action"
}
}
Copyright © Josh Software Pvt. Ltd.