Skip to content

architecture

Chris Matheny edited this page Mar 15, 2017 · 61 revisions

Architecture


Data Retrieval Endpoints (with example returns)

Note: All endpoints are prefixed by https://interview-evaluations.revaturelabs.com/api/v1/

Batch

JSON Object Format:

{
  "id": 0,
  "name": "string",
  "persons": [
    {
      "firstName": "string",
      "id": 0,
      "lastName": "string",
      "personRole": {
        "id": 0,
        "title": "string"
      }
    }
  ]
}

Create a new batch

Endpoint:

batches

Method: POST

Path Variables:

none    

JSON Input:

{
  "name": "string"
}

OR

{
  "name": "string",
  "persons": [
    {
      "id": integer
    },
    {
      "id": integer
    }
  ]
}

Add members to a batch

Endpoint:

batches/{batchId}/members

Method: POST

Path Variables:

batchId: integer (required - batch must exist) 

JSON Input:

[
  integer,
  integer,
  ...
]  

Retrieve all batches in the database

Endpoint:

batches

Method: GET

Path Variables:

none   

Retrieve all Evaluations for a Batch at a given Week

Endpoint:

batches/{batchId}/week/{weekNum}

Method: GET

Path Variables:

batchId: integer (required - batch must exist) 
weekNum: integer (required - week must be valid) 

Update the name of a batch and/or the members associated with it

Endpoint:

batches/{batchId}

Method: PUT

Path Variables:

batchId: integer (required - batch must exist) 

JSON Input:

{
  "name": "string"
}

OR

{
  "name": "string",
  "persons": [
    {
      "id": integer
    },
    {
      "id": integer
    }
  ]
}

Delete a batch and all Evaluations associated with it

Endpoint:

batches/{batchID}

Method: DELETE

Path Variables:

batchId: integer (required - batch must exist) 

Delete members from a batch

Endpoint:

batches/{batchId}/members

Method: DELETE

Path Variables:

batchId: Integer (required - batch must exist)   

Eval

JSON Object Format:

{
  "batch": {
    "id": 0,
    "name": "string"
  },
  "comments": [
    {
      "commentText": "string",
      "id": 0
    }
  ],
  "date": "2017-03-09",
  "evalType": {
    "description": "string",
    "id": 0
  },
  "id": 0,
  "questions": [
    {
      "comments": [
        {
          "commentText": "string",
          "id": 0
        }
      ],
      "communicationScore": 0,
      "id": 0,
      "knowledgeScore": 0,
      "questionPool": {
        "dateLastUsed": "2017-03-09",
        "id": 0,
        "maxCommunicationScore": 0,
        "maxKnowledgeScore": 0,
        "questionText": "string",
        "subjectId": {
          "id": 0,
          "subject": "string"
        },
        "useCount": 0
      }
    }
  ],
  "trainee": {
    "firstName": "string",
    "id": 0,
    "lastName": "string",
    "personRole": 0
  },
  "week": 0
}

Create new Eval

Endpoint:

evaluations   

Method: POST

PathVariables:

none   

JSON Input:

{
  "batch": {
    "id": integer (required)
  },
  "evalType": {
    "id": integer (required)
  },
  "trainee": {
    "id": integer (required)
  },
  "week": integer (required)
}

Retrieve single Evaluation by ID

Endpoint:

evaluations/{id}

Method: GET

Retrieve all Evaluations of a specified Trainee

Endpoint:

evaluations/trainees/{traineeId}

Method: GET

PathVariables:

traineeId: Integer (required - trainee must exist)   

Retrieve all Evaluations of a specified Trainee at a specified Week

Endpoint:

evaluations/trainees/{traineeId}/week/{weekNumber}

Method: GET

PathVariables:

traineeId: Integer (required - trainee must exist)   
weekNumber: Integer (required - eval for indicated week must exist)

Update Eval by ID

Endpoint:

evaluations/{evalId}   

Method: PUT

PathVariables:

evalId: Integer (required - eval must exist)   

JSON Input:

{
  "batch": {
    "id": integer
  }
  "evalType": {
    "id": integer
  },
  "trainee": {
    "id": integer
  },
  "week": integer
}

Delete Eval by ID

Endpoint:

evaluations/{evalId}

Method: DELETE

PathVariables:

evalId: Integer (required - eval must exist)

Person

JSON Object Format:

{
  "id": integer,
  "firstName": "string",
  "lastName": "string",
  "personRole": {
    "id": integer,
    "title": "string"
  }
}

Create a new person

Endpoint:

persons

Method: POST

PathVariables:

none   

JSON Input:

{   
  "firstName": "string", (required)   
  "lastName": "string", (required)   
  "personRole": {
    "id": integer (required)
  }
}   

Retrieve a single Person by Id

Endpoint:

persons/{personId}   

Method: GET

PathVariables:

personId: Integer (required - person must exist)   

Retrieve page-able list of all Persons

Endpoint:

persons/

Method: GET

PathVariables:

none    

Retrieve a page-able list of person/persons by first name and/or last name

Endpoints:

persons?firstname={firstname}
              or
persons?lastname={lastname}
              or
persons?firstname={firstname}&lastname={lastname}

Method: GET

PathVariables:

firstname: String (required - person must exist)   
lastname: String (required - person must exist)   

Retrieve persons by their role (trainer or trainee)

Endpoint:

persons?role={role}

Method: GET

PathVariables:

role: String (required - role must be trainee or trainer)   

Update an existing person

Endpoint:

persons/{personId}

Method: PUT

PathVariables:

personId: Integer (required - person must exist)   

JSON Input:

{   
  "firstName": "string",   
  "lastName": "string", 
  "personRole": {
    "id": integer
  }
}   

Delete an existing person

Endpoint:

persons/{personId}

Method: DELETE

PathVariables:

personId: Integer (required - person must exist)   

Questions

JSON Object Format:

[
    {
      "dateLastUsed": "2017-03-07",
      "id": 0,
      "maxCommunicationScore": 0,
      "maxKnowledgeScore": 0,
      "questionText": "string",
      "subjectId": {
        "id": 0,
        "subject": "string"
      },
      "useCount": 0
    }
]

Create new Question

Endpoint:

questions   

Method: POST

PathVariables:

none   

JSON Input:

{
    "maxCommunicationScore": 20, (required - must be positive)           
    "maxKnowledgeScore": 20, (required - must be positive)   
    "questionText": "What is....?", (required)
    "subject": {"id": 1} (required - subject must exist)         
}

Retrieve pageable list of all Questions

Endpoint:

questions

Method: GET

Retrieve specific Question or list of Questions by Subject

Endpoints:

questions/search?searchText={question text}   
                   or   
questions/search?subject={subject name}   

Method: GET

Update Question by ID

Endpoint:

questions/{questionId}   

Method: PUT

PathVariables:

questionId: Integer (required - question must exist)   

JSON Input:

{
    "maxCommunicationScore": integer, (required - must be positive)           
    "maxKnowledgeScore": integer, (required - must be positive)   
    "questionText": "string", (required)
    "subject": {
        "id": integer (required - subject must exist)     
    }     
}

Delete Question by ID

Endpoint:

questions/{questionId}

Method: DELETE

PathVariables:

questionId: Integer (required - question must exist)   

EvalComment

Create new EvalComment

Endpoint:

evaluations/{evalId}/comments   

Method: POST

PathVariables:

evalId: Integer (required - eval must exist)   

JSON Input:

{
    "commentText": "Eval Comment Text" (required)
}   

Update EvalComment by ID

Endpoint:

evaluations/{evalId}/comments/{commentId}   

Method: PUT

PathVariables:

evalId: Integer (required - eval must exist)   
commentId: Integer (required - comment must exist)   

JSON Input:

{
    "commentText": "Eval Comment Text" (required)
}   

Delete EvalComment by ID

Endpoint:

evaluations/{evalId}/comments/{commentId}

Method: DELETE

PathVariables:

evalId: Integer (required - eval must exist)   
commentId: Integer (required - comment must exist)   

QuestionComment

Create new QuestionComment

Endpoint:

evaluations/{evalId}/questions/{questionId}/comments   

Method: POST

PathVariables:

evalId: Integer (currently ignored - included in url for consistency)   
questionId: Integer (required - question eval must exist)   

JSON Input:

{
    "commentText": "Question Comment Text" (required)
}   

Update QuestionComment by ID

Endpoint:

evaluations/{evalId}/questions/{questionId}/comments/{commentId}   

Method: PUT

PathVariables:

evalId: Integer (currently ignored - included in url for consistency)   
questionId: Integer (required - question eval must exist)   
commentId: Integer (required - comment must exist)   

JSON Input:

{
    "commentText": "Question Comment Text" (required)
}   

Delete QuestionComment by ID

Endpoint:

evaluations/{evalId}/questions/{questionId}/comments/{commentId}   

Method: DELETE

PathVariables:

evalId: Integer (currently ignored - included in url for consistency)   
questionId: Integer (required - question eval must exist)   
commentId: Integer (required - comment must exist)   

Clone this wiki locally