Skip to content

Instantly share code, notes, and snippets.

@benaubin
Created May 12, 2015 17:59
Show Gist options
  • Save benaubin/024134bf6eba3bb6f2e1 to your computer and use it in GitHub Desktop.
Save benaubin/024134bf6eba3bb6f2e1 to your computer and use it in GitHub Desktop.
PlanHWDocs
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "PlanHW",
"description": "#### PlanHW is your new planner - And it's the planner YOU make\nPlanHW has an awesome API that lets you focus on making an awesome planner, and not reinventing the wheel. It's pretty cool, and allows you to make planners that inigrate seemlessly [online](http://planhw.com).\n",
"termsOfService": "http://planhw.com/tos",
"contact": {
"name": "Ben (from BenSites.com)",
"email": "[email protected]",
"url": "http://BenSites.com"
}
},
"produces": [
"application/json",
"text/plain"
],
"schemes": [
"https"
],
"host": "api.planhw.com",
"paths": {
"/": {
"get": {
"summary": "Root",
"description": "Just a quick message, usefull for testing you are connected to the PlanHW server.",
"responses": {
"200": {
"description": "Root of PlanHW"
}
}
}
},
"/login": {
"get": {
"tags": [
"Login"
],
"summary": "Login",
"description": "Logins in the student by username and password, returns a token to send\non future requests. The token lasts for 30 days before a new one has to\nbe generated. It is based off of [JWT](//jwt.io).\n",
"parameters": [
{
"name": "username",
"in": "query",
"description": "Username",
"required": true,
"type": "string"
},
{
"name": "password",
"in": "query",
"description": "Password",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Login successful",
"schema": {
"type": "object",
"properties": {
"student": {
"type": "object",
"$ref": "#/definitions/student"
},
"token": {
"type": "string"
}
}
}
},
"401": {
"description": "Wrong username or password"
}
}
}
},
"/test/login": {
"get": {
"tags": [
"Login"
],
"summary": "Test login (or get student data from JWT)",
"description": "Gets a student from a JWT token.\n",
"parameters": [
{
"name": "token",
"in": "query",
"description": "Token",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Token worked.",
"schema": {
"$ref": "#/definitions/student"
}
},
"401": {
"description": "Invalid token."
}
}
}
},
"/reset_password/{username}": {
"get": {
"tags": [
"Login"
],
"summary": "Resets password",
"description": "Sends user a reset password email (email must have been activated before)\n",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Username",
"required": true,
"type": "string"
}
],
"responses": {
"202": {
"description": "Reset email queued for sending."
},
"404": {
"description": "Student not found."
},
"406": {
"description": "Account not activated."
}
}
}
},
"/students": {
"get": {
"tags": [
"Students"
],
"summary": "Students list",
"description": "A list of students (helpful for search or autocorrect)\n",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"student": {
"type": "object",
"$ref": "#/definitions/student"
},
"postfix": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"value": {
"type": "number"
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Students"
],
"summary": "Signup",
"description": "Creates a student\n",
"parameters": [
{
"name": "student",
"in": "body",
"description": "Name",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"student": {
"type": "object",
"$ref": "#/definitions/student"
},
"postfix": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"value": {
"type": "number"
}
}
}
}
}
}
}
}
}
},
"definitions": {
"student": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"username": {
"type": "string"
},
"avatars": {
"type": "object",
"properties": {
"default": {
"type": "string"
},
"size10": {
"type": "string"
},
"size25": {
"type": "string"
},
"size50": {
"type": "string"
},
"size125": {
"type": "string"
},
"size250": {
"type": "string"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment