NAV Navigation
HTTP curl Javascript Python

Candidate Interview v1.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

This is the API for pairing and coding assessments in our Interview Process.

Base URLs:

Email: Common Room, Inc Web: Common Room, Inc

Authentication

Once you have your access token, pass it in the Authorization header in the format of {type} {token} - for example, a token foo with type bearer would be bearer foo.

- Flow: implicit
Scope Scope Description
quotes May be be used to access to the Quotes API
offline May be used to refresh an access token.
assessment May be used during an assessment.
initialize May be used to start an assessment.

Default

Health Check Endpoint

Code samples

GET https://candidate.commonroom.builders/healthz HTTP/1.1
Host: candidate.commonroom.builders

# You can also use wget
curl -X GET https://candidate.commonroom.builders/healthz


fetch('https://candidate.commonroom.builders/healthz',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests

r = requests.get('https://candidate.commonroom.builders/healthz')

print(r.json())

GET /healthz

Responses

Status Meaning Description Schema
200 OK Server is Healthy None

Create an Authentication Token

Code samples

POST https://candidate.commonroom.builders/auth/token HTTP/1.1
Host: candidate.commonroom.builders
Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X POST https://candidate.commonroom.builders/auth/token \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const inputBody = '{
  "grant_type": "refresh_token",
  "refresh_token": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://candidate.commonroom.builders/auth/token',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://candidate.commonroom.builders/auth/token', headers = headers)

print(r.json())

POST /auth/token

OAuth2 Token endpoint allowing for refresh and other token exchange mechanisms.

Body parameter

{
  "grant_type": "refresh_token",
  "refresh_token": "string"
}
grant_type: refresh_token
refresh_token: string

Parameters

Name In Type Required Description
body body object false none
» grant_type body string true The Grant Type to use for this operation.
» refresh_token body string true The refresh token to use for this operation.

Enumerated Values

Parameter Value
» grant_type refresh_token

Example responses

200 Response

{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "Bearer",
  "expires_in": 0,
  "refresh_expires_in": 0
}

Responses

Status Meaning Description Schema
200 OK Refresh Successful Inline
401 Unauthorized Refresh token is Invalid Error
403 Forbidden Token has been revoked. Error
429 Too Many Requests Cannot Refresh so Quickly Error

Response Schema

Status Code 200

Name Type Required Restrictions Description
» access_token string true none The created access token.
» refresh_token string false none The refresh token that may be used next.
» token_type string true none The type of access token that was created.
» expires_in integer true none Seconds until the access token expires.
» refresh_expires_in integer false none Seconds until the refresh token expires.

Enumerated Values

Property Value
token_type Bearer

Response Headers

Status Header Type Format Description
429 Retry-After integer Number of seconds until a refresh can be performed.

Instructions

Code samples

GET https://candidate.commonroom.builders/instructions HTTP/1.1
Host: candidate.commonroom.builders
Accept: text/plain

# You can also use wget
curl -X GET https://candidate.commonroom.builders/instructions \
  -H 'Accept: text/plain' \
  -H 'Authorization: Bearer {access-token}'


const headers = {
  'Accept':'text/plain',
  'Authorization':'Bearer {access-token}'
};

fetch('https://candidate.commonroom.builders/instructions',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'text/plain',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://candidate.commonroom.builders/instructions', headers = headers)

print(r.json())

GET /instructions

Retrieves the Instructions for a candidate, dependent on the API token specified.

Example responses

Responses

Status Meaning Description Schema
200 OK OK None

Response Schema

Quotes

Code samples

GET https://candidate.commonroom.builders/quotes HTTP/1.1
Host: candidate.commonroom.builders
Accept: application/json
Accept: string
Last-Event-ID: string

# You can also use wget
curl -X GET https://candidate.commonroom.builders/quotes \
  -H 'Accept: application/json' \
  -H 'Accept: string' \
  -H 'Last-Event-ID: string' \
  -H 'Authorization: Bearer {access-token}'


const headers = {
  'Accept':'application/json',
  'Accept':'string',
  'Last-Event-ID':'string',
  'Authorization':'Bearer {access-token}'
};

fetch('https://candidate.commonroom.builders/quotes',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Accept': 'string',
  'Last-Event-ID': 'string',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://candidate.commonroom.builders/quotes', headers = headers)

print(r.json())

GET /quotes

Gets famous quotes from the server.

Pagination information can be found in the response's Link headers.

May also be a server-sent events stream when requested via the Accept header.

Parameters

Name In Type Required Description
Accept header string false The Accept Header may be application/json or text/event-stream. If it is text/event-stream the server will start a Server-Sent Events session.
Last-Event-ID header string(ulid) false When using Server-Sent events, the last event ID seen by the client to enable reconnects without losing data.
cursor query string(ulid) false Used to reference where to start the quotes.

Example responses

200 Response

[
  {
    "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "created": "2020-04-10T04:34:16Z",
    "text": "Hello World",
    "author": "This Very API!",
    "uri": "http://example.com/"
  },
  {
    "id": "01ARZ3NDEKTSV4RRFFQ69G5FAA",
    "created": "2020-04-10T04:34:16Z",
    "text": "Hello Earth",
    "author": "This Very API!",
    "uri": "http://example.com/"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Quote] false none [A Quote from an important person!]
» Quote Quote false none A Quote from an important person!
»» id string(ulid) true none none
»» created string(date-time) true none When the quote was added to the API
»» text string true none What was said.
»» author string true none Who said it.
»» uri string(uri) true none An image URI to go along with the quote.

Response Headers

Status Header Type Format Description
200 Link string RFC8288 Web Links referring to the current link ("self") or the next page ("next")

Get All Analysis

Code samples

GET https://candidate.commonroom.builders/quotes/analysis HTTP/1.1
Host: candidate.commonroom.builders
Accept: application/json

# You can also use wget
curl -X GET https://candidate.commonroom.builders/quotes/analysis \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://candidate.commonroom.builders/quotes/analysis',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://candidate.commonroom.builders/quotes/analysis', headers = headers)

print(r.json())

GET /quotes/analysis

Example responses

200 Response

[
  {
    "description": "string",
    "link": "string",
    "submitted": "string",
    "example": null
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Analysis] false none none
» Analysis Analysis false none none
»» description string false none What the analysis is.
»» link string false none Where to POST the analysis.
»» submitted string false none When the correct analysis has been submitted.
»» example any false none An Example for what should be published.

Publish an Analysis by Type

Code samples

PUT https://candidate.commonroom.builders/quotes/analysis/{type} HTTP/1.1
Host: candidate.commonroom.builders
Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X PUT https://candidate.commonroom.builders/quotes/analysis/{type} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

const inputBody = 'null';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://candidate.commonroom.builders/quotes/analysis/{type}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.put('https://candidate.commonroom.builders/quotes/analysis/{type}', headers = headers)

print(r.json())

PUT /quotes/analysis/{type}

Body parameter

null

Parameters

Name In Type Required Description
body body any false The payload for the analysis.
type path string true none

Example responses

400 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
204 No Content No Content None
400 Bad Request Analysis is invalid. Error
404 Not Found Analysis cannot be found. Error

Schemas

Error

{
  "message": "string"
}

Error

Properties

Name Type Required Restrictions Description
message string true none none

Quote

{
  "id": "string",
  "created": "2022-06-08T15:35:35Z",
  "text": "string",
  "author": "string",
  "uri": "http://example.com"
}

Quote

Properties

Name Type Required Restrictions Description
id string(ulid) true none none
created string(date-time) true none When the quote was added to the API
text string true none What was said.
author string true none Who said it.
uri string(uri) true none An image URI to go along with the quote.

Analysis

{
  "description": "string",
  "link": "string",
  "submitted": "string",
  "example": null
}

Analysis

Properties

Name Type Required Restrictions Description
description string false none What the analysis is.
link string false none Where to POST the analysis.
submitted string false none When the correct analysis has been submitted.
example any false none An Example for what should be published.