Roaster

The Roaster API let’s people validate their code using statical code analysis. Users can register and track their progress, also allowing friends to follow your progress.

Resource Group

Roaster API Root

This resource returns the base index.html. The index contains JavaScript that implements a SPA (Single Page Application) that is able to communicate with the API.

GET https://roast.software//
Responses200
Headers
Content-Type: text/html
Body
<!DOCTYPE html>
<html [...]>
[... The roast.software SPA ...]
</html>

Retrieve the roast.software SPA
GET/


User

POST https://roast.software//user
Requestsa user registration
Headers
Content-Type: application/json
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "password": "MyTr3me3d0usPassw0rd!",
  "fullname": "Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string"
    },
    "fullname": {
      "type": "string",
      "required": false
    }
  }
}
Responses200400409
Headers
Content-Type: application/json
Set-Cookie: roaster_auth=AB32DEAC21A91DE123[...]; Expires=Wed, 21 Oct 2015 07:28:00 GMT;
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "fullname": "Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "fullname": {
      "type": "string"
    }
  }
}

Bad request with either invalid/missing fields or unparsable data structure.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Email or username is conflicting with an already registered user.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Create User
POST/user


View/Handle Specific User

PATCH https://roast.software//user/
Requestschange user
Headers
Content-Type: application/json
Body
{
  "email": "email@example.com",
  "fullname": "Sir. Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "required": false
    },
    "fullname": {
      "type": "string",
      "required": false
    }
  }
}
Responses200400409
Headers
Content-Type: application/json
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "fullname": "Sir. Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "required": false
    },
    "username": {
      "type": "string"
    },
    "fullname": {
      "type": "string",
      "required": false
    }
  }
}

Bad request with either invalid/missing fields or unparsable data structure.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Email is conflicting with an already registered user.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Change User
PATCH/user/


GET https://roast.software//user/
Requestsuser information
This response has no content.
Responses200400404
Headers
Content-Type: application/json
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "fullname": "Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "fullname": {
      "type": "string"
    }
  }
}

Bad request with missing username parameter.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Requested user does not exist.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Retrieve User Information
GET/user/


User Score

GET https://roast.software//user/score
Requestsuser score
This response has no content.
Responses200404
Headers
Content-Type: application/json
Body
{
  "score": 123
}
Schema
{
  "type": "object",
  "properties": {
    "score": {
      "type": "number"
    }
  }
}

Requested user does not exist.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Retrieve User Score
GET/user/score


DELETE https://roast.software//user/score
Requestsremove user
Headers
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Responses501

Not implemented.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Remove User
DELETE/user/score


Avatar For User

PUT https://roast.software//user/avatar
Requestsimage to upload
Headers
Content-Type: multipart/form-data; boundary=---BOUNDARY
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Body
--{boundary value}
Content-Disposition: form-data; name="file"; filename="image.jpg"
Content-Type: image/jpeg (according to the type of the uploaded file)
{file content}
--{boundary value}
Responses204401400413415
This response has no content.

Unauthorized request, must be logged in to upload avatar.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Invalid Content-Type or unreadable data in request.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Too large file sent.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Invalid image type, supported formats are: JPEG, PNG and GIF.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Upload User Avatar
PUT/user/avatar


GET https://roast.software//user/avatar
Requestsuser avatar
This response has no content.
Responses200404
Headers
Content-Type: image/png

Requested user does not exist.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Retrieve User Avatar
GET/user/avatar


Followees for User

POST https://roast.software//user/followees
Requestsadd new followee
Headers
Content-Type: application/json
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Body
{
  "followee": "InterestingFollowee"
}
Schema
{
  "type": "object",
  "properties": {
    "followee": {
      "type": "string",
      "required": true
    }
  }
}
Responses200400404
This response has no content.

Missing followee field or unparsable data structure.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Requested followee does not exist.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Add New Followee
POST/user/followees


GET https://roast.software//user/followees
Requestsuser followees
This response has no content.
Responses200204400404
Headers
Content-Type: application/json
Body
{
"followees": [
    {
        "username":"MyAwesomeFollowee",
        "createTime":"2018-03-04:00:00:00Z"
    }
    {
        "username":"MyAwesomeFollowee2",
        "createTime":"2018-07-04:00:00:00Z"
    }
]
}
Schema
{
"type": "object",
"properties": {
    "followees":
    {
        "type": "array",
        "items": {
            "type": "string"
        }
    }
}
}
This response has no content.

Missing username in request.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Requested user does not exist.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Retrieve User Followees
GET/user/followees


DELETE https://roast.software//user/followees
Requestsremove user followee
Headers
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Responses200400
This response has no content.

Missing username for lookup.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Remove User Followee
DELETE/user/followees


GET https://roast.software//user/followees
Requestsuser followers
This response has no content.
Responses200204400
Headers
Content-Type: application/json
Body
{
"followers": [
    {
        "username":"MyAwesomeFollower",
        "createTime":"2018-03-04:00:00:00Z"
    }
    {
        "username":"MyAwesomeFollower2",
        "createTime":"2018-07-04:00:00:00Z"
    }
]
}
Schema
{
"type": "object",
"properties": {
    "followers":
    {
        "type": "array",
        "items": {
            "type": "string"
        }
    }
}
}
This response has no content.

Missing username for lookup.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Retrieve User Followers
GET/user/followees


Session

POST https://roast.software//session
Requestsa session authentication
Headers
Content-Type: application/json
Body
{
"username": "roastin_roger",
"password": "MyTr3me3d0usPassw0rd!",
}
Schema
{
"type": "object",
"properties": {
    "username": {
        "type": "string"
    },
    "password": {
        "type": "string"
    }

}
}
Responses200400401
Headers
Content-Type: application/json
Set-Cookie: roaster_auth=AB32DEAC21A91DE123[...]; Expires=Wed, 21 Oct 2015 07:28:00 GMT;
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "fullname": "Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "fullname": {
      "type": "string"
    }
  }
}

Empty username or password field or unparsable data structure.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Invalid username or password.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Authenticate for New Session (sign in)
POST/session


GET https://roast.software//session
Requestscurrent session
Headers
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Responses200204
Headers
Content-Type: application/json
Body
{
  "email": "email@example.com",
  "username": "roastin_roger",
  "fullname": "Roger Roger"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "fullname": {
      "type": "string"
    }
  }
}
This response has no content.

Get Current Session (resume login session)
GET/session


DELETE https://roast.software//session
Requestsremove current session
Headers
Cookie: roaster_auth=AB32DEAC21A91DE123[...]
Responses200
Headers
Set-Cookie: roaster_auth=deleted; Expires=Thu, 01 Jan 1970 00:00:00 GMT;

Remove Current Session (sign out)
DELETE/session


Roast

POST https://roast.software//roast
Requestsa static analysation of provided code snippet
Headers
Content-Type: application/json
Cookie: roaster_auth=AB32DEAC21A91DE123[...] (string, optional) - Should be sent if user has an active session.
Body
{
"language": "python3",
"code": "print('I´m Roastin´ Roger... Roger.', invalid = 'Bönor är ändå rätt gött')",
}
Schema
{
"type": "object",
"properties": {
    "language": {
        "type": "string"
    },
    "code": {
        "type": "string"
    }

}
}
Responses200400
Headers
Content-Type: application/json
Body
{
  "username": "willeponken",
  "language": "python3",
  "code": "print('I´m Roastin´ Roger... Roger.', invalid = 'Bönor är ändå rätt gött'",
  "createTime": "2018-12-17T23:00:00Z",
  "score": 12,
  "warnings": [
    {
      "row": 1,
      "column": 48,
      "engine": "pycodestyle",
      "name": "E251",
      "description": "no spaces around keyword / parameter equals"
    }
  ],
  "errors": [
    {
      "row": 1,
      "column": 41,
      "engine": "pyflakes",
      "name": "TypeError",
      "description": "print() got an unexpected keyword argument 'invalid'"
    }
  ],
  "statistics": {
    "numberOfErrors": 1,
    "numberOfWarnings": 1,
    "linesOfCode": 1
  }
}
Schema
{
  "type": "object",
  "properties": {
    "username": {
      "type": "string"
    },
    "score": {
      "type": "number"
    },
    "language": {
      "type": "string"
    },
    "code": {
      "type": "string"
    },
    "createTime": {
      "type": "string"
    },
    "statistics": {
      "type": "object",
      "properties": {
        "linesOfCode": {
          "type": "number"
        },
        "numberOfWarnings": {
          "type": "number"
        },
        "numberOfErrors": {
          "type": "number"
        }
      }
    },
    "warning": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number"
          },
          "column": {
            "type": "number"
          },
          "engine": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      }
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "number"
          },
          "column": {
            "type": "number"
          },
          "engine": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      }
    }
  }
}

Invalid Roast data sent.

Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Analyze code snippet
POST/roast


Feed

GET https://roast.software//feed?user=willeponken?followees=true?page=0?page-size=25
Requestsa feed
Headers
Content-Type: application/json
Responses200400
Headers
Content-Type: application/json
Body
{
  "items": [
    {
      "category": 0,
      "username": "JustARegularUsername",
      "title": "Woah, this user failed!",
      "description": "Something happened [...]",
      "time": "Mon Dec  3 10:51:52 CET 2018"
    },
    {
      "category": 3,
      "username": "JustAnotherRegularUsername",
      "title": "Woah, this user also failed!",
      "description": "Something happened [...]",
      "time": "Mon Dec  3 09:48:12 CET 2018"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "category": {
            "type": "number"
          },
          "username": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "time": {
            "type": "string"
          }
        }
      }
    }
  }
}
Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Get Feed
GET/feed{?user}{?followees}{?page}{?page-size}

URI Parameters
HideShow
page
number (required) Example: 0

Page of feed to return.

page-size
number (optional) Default: 25 Example: 25

Page size for each page.

user
string (optional) Example: willeponken

Display only for user.

followees
string (optional) Example: true

Display only user followees (excluding user).


Statistics

Roast Statistics Timeseries

GET https://roast.software//statistics/roast/timeseries?start=2018-12-17T23:00:00Z?end=2018-12-17T23:10:00Z?interval=10m?user=willeponken?followees=true
RequestsRoast count statistics as time series
This response has no content.
Responses200400
Headers
Content-Type: application/json
Body
[
  {
    "timestamp": "2018-12-17T23:10:00Z",
    "count": 123,
    "numberOfErrors": 231,
    "numberOfWarnings": 210,
    "linesOfCode": 5901
  },
  {
    "timestamp": "2018-12-17T23:00:00Z",
    "count": 32,
    "numberOfErrors": 5,
    "numberOfWarnings": 7,
    "linesOfCode": 512
  }
]
Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Get Statistics for Roasts as Time series
GET/statistics/roast/timeseries{?start}{?end}{?interval}{?user}{?followees}

URI Parameters
HideShow
start
string (required) Example: 2018-12-17T23:00:00Z

Start date according to RFC3339.

end
string (required) Example: 2018-12-17T23:10:00Z

End date according to RFC3339.

interval
string (required) Example: 10m

Interval for each data point in time unit, such as ‘m’, ‘h’ etc.

user
string (optional) Example: willeponken

Show statistics for specific user.

followees
string (optional) Example: true

Show statistics for specific user followees (excluding user).


Roast Statistics Count

GET https://roast.software//statistics/roast/count?user=willeponken?followees=true
RequestsNumber of Roasts
This response has no content.
Responses200400
Headers
Content-Type: application/json
Body
{
  "count": 321
}
Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Get Number of Roasts
GET/statistics/roast/count{?user}{?followees}

URI Parameters
HideShow
user
string (optional) Example: willeponken

Show count for specific user.

followees
string (optional) Example: true

Show count for specific user followees (excluding user).


Roast Statistics Lines of Code

GET https://roast.software//statistics/roast/lines?user=willeponken?followees=true
RequestsLines of code analyzed
This response has no content.
Responses200400
Headers
Content-Type: application/json
Body
{
  "lines": 321
}
Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Get Lines of Code Analyzed
GET/statistics/roast/lines{?user}{?followees}

URI Parameters
HideShow
user
string (optional) Example: willeponken

Show lines of code for specific user.

followees
string (optional) Example: true

Show lines of code for specific user followees (excluding user).


GET https://roast.software//search?query=willeponken%2Fcool+guy
Requestssearch results for query
This response has no content.
Responses200204400
Headers
Content-Type: application/json
Body
[
  {
    "category": 0,
    "title": "User willeponken",
    "description": "A really cool guy, named willeponken",
    "url": "/user/willeponken"
  },
  {
    "category": 0,
    "title": "User coolguy",
    "description": "A really willeponken, named coolguy",
    "url": "/user/coolguy"
  }
]
Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "category": {
        "type": "number"
      },
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "url": {
        "type": "string"
      }
    }
  }
}
This response has no content.
Headers
Content-Type: application/json
Body
{
  "message": "An error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  }
}

Search for content
GET/search{?query}

URI Parameters
HideShow
query
string (required) Example: willeponken%2Fcool+guy

Search query (percent-encoded).


Generated by aglio on 09 Jan 2020