-
Notifications
You must be signed in to change notification settings - Fork 10
2018‐05 Microservices
The Attendance Microservice allows a user to register whether they will be present or absent from a paper.
POST
GET
---
swagger: 2.0
info:
version: "2017-09-04T07:10:30Z"
title: "dev-attendance-microservice"
host: "v7uvize1nc.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/attendance:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Attendees"
security:
- 1_0Hd1KoM5a: []
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Attendance"
required: true
schema:
$ref: "#/definitions/Attendance"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Attendance"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
Attendance:
type: "object"
properties:
studentId:
type: "string"
description: "A unique student identifier."
createdAt:
type: "string"
format: "date-time"
description: "Record creation date (read only)."
classDate:
type: "string"
format: "date-time"
description: "Class date date (read only)."
paperId:
type: "string"
description: "A unique paper identifier."
status:
type: "string"
description: "Status of the student - present | absent"
title: "Attendance"
Attendees:
title: "Attendees"
type: "array"
items:
$ref: "#/definitions/Attendance"
Make sure header content-type is set to _application/json_
in your REST Client
N.B. call the Composite Service addAttendance() function to register your attendance.
- HTTP POST
- HTTP GET
Header Authorization:<IdToken>
(filter parameters studentId=? and/or paperId=?)
Figure 14: validation for student registration
The add paper orchestration allows an administrator to add a new course to the system, checking that the lecturer and room Id's passed are valid Id's in the system before creating the paper.
Figure 15: Add paper Orchestration
The add registration orchestration allows a student to register to take a particular paper in the system, first checking that they are a valid student and that the desired paper exists within the system.
Figure 16: Add registration orchestration
The signup form allows a user to register an identity and link it to their user profile for access to the system. An administrator must've first created their user record in the system. This orchestration will check for the existence of the user record, create their identity and assign it to an identity group based off information in the user record.
POST
- addAttendance https://xgdeevdwh1.execute-api.us-east-1.amazonaws.com/addAttendance
- addRegistration https://xgdeevdwh1.execute-api.us-east-1.amazonaws.com/addRegistration
- addPaper https://xgdeevdwh1.execute-api.us-east-1.amazonaws.com/addPaper
- signup https://xgdeevdwh1.execute-api.us-east-1.amazonaws.com/signup
swagger: "2.0"
info:
version: "2017-09-02T10:54:01Z"
title: "dev-composite-service"
host: "xgdeevdwh1.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/addAttendance:
post:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/addPaper:
post:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/addRegistration:
post:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/signup:
post:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
definitions:
Empty:
type: "object"
title: "Empty Schema"
The Identity Microservice allows a user to login/logout/signup to the Attendance application.
POST
- login AWS API gateway Login
- Identity https://ctpoixww04.execute-api.us-east-1.amazonaws.com/dev/identity
- Identity by Id grouping https://ctpoixww04.execute-api.us-east-1.amazonaws.com/dev/identity/{id}/group
GET
swagger: "2.0"
info:
version: "2017-09-01T22:11:06Z"
title: "dev-identity-microservice"
host: "ctpoixww04.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/identity:
post:
consumes:
- "application/json"
parameters:
- in: "body"
name: "CreateIdentityRequest"
required: true
schema:
$ref: "#/definitions/CreateIdentityRequest"
responses: {}
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/identity/{id}/group:
post:
consumes:
- "application/json"
parameters:
- in: "body"
name: "AddIdentityToGroupRequest"
required: true
schema:
$ref: "#/definitions/AddIdentityToGroupRequest"
responses: {}
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/login:
post:
consumes:
- "application/json"
parameters:
- in: "body"
name: "LoginRequest"
required: true
schema:
$ref: "#/definitions/LoginRequest"
responses: {}
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/session:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Session"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/token:
post:
consumes:
- "application/json"
parameters:
- in: "body"
name: "TokenRequest"
required: true
schema:
$ref: "#/definitions/TokenRequest"
responses: {}
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
CreateIdentityRequest:
type: "object"
required:
- "email"
- "id"
- "password"
properties:
password:
type: "string"
id:
type: "string"
email:
type: "string"
title: "CreateIdentityRequest"
TokenRequest:
type: "object"
required:
- "id"
- "refreshToken"
properties:
id:
type: "string"
refreshToken:
type: "string"
title: "TokenRequest"
AddIdentityToGroupRequest:
type: "object"
required:
- "group"
properties:
group:
type: "string"
title: "AddIdentityToGroupRequest"
LoginRequest:
type: "object"
required:
- "id"
- "password"
properties:
password:
type: "string"
id:
type: "string"
title: "LoginRequest"
Session:
type: "object"
properties:
groups:
type: "string"
description: "Group membership of the current logged-in User."
username:
type: "string"
description: "Current logged-in User."
title: "Session"
Make sure header content-type is set to application/json
HTTP Post Request N.B. call the Composite Service sign up function to register your user id.
{
"id": "246810",
"password": "Value12#"
}
Header
Authorization:<IdToken>
no body
The Paper Microservice allows users to create, update, query and delete papers/courses.
POST
GET
- Paper by Id https://m4pss0w907.execute-api.us-east-1.amazonaws.com/dev/paper/{id}
- Paper https://m4pss0w907.execute-api.us-east-1.amazonaws.com/dev/paper
PUT
PATCH
DELETE
swagger: "2.0"
info:
version: "2017-09-04T07:12:14Z"
title: "dev-paper-microservice"
host: "m4pss0w907.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/paper:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Papers"
security:
- 1_0Hd1KoM5a: []
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Paper"
required: true
schema:
$ref: "#/definitions/Paper"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Paper"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/paper/{id}:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Paper"
security:
- 1_0Hd1KoM5a: []
put:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Paper"
required: true
schema:
$ref: "#/definitions/Paper"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Paper"
security:
- 1_0Hd1KoM5a: []
delete:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Paper"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
patch:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Paper"
required: true
schema:
$ref: "#/definitions/Paper"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Paper"
security:
- 1_0Hd1KoM5a: []
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
Papers:
title: "Papers"
type: "array"
items:
$ref: "#/definitions/Paper"
Paper:
type: "object"
properties:
lecturerId:
type: "string"
description: "A unique lecturer identifier."
createdAt:
type: "string"
format: "date-time"
description: "Record creation date (read only)."
stream:
type: "string"
description: "Stream of the paper."
year:
type: "string"
description: "Semester of the paper."
name:
type: "string"
description: "Descriptive name of the paper."
id:
type: "string"
description: "A unique paper identifier."
room:
type: "string"
description: "Reference to the building and room location of the paper."
status:
type: "string"
description: "Status of the paper - active|inactive."
updatedAt:
type: "string"
format: "date-time"
description: "Record update date (read only)."
title: "Paper" Sample Payloads
Make sure header content-type is set to application/json
N.B. call the Composite Service addPaper function to register your new Class course
The Registration Microservice allows a user to register to attend a paper
POST
GET
-
registration by ID https://tsom3l8zzg.execute-api.us-east-1.amazonaws.com/dev/registration/{id}
-
Registration https://tsom3l8zzg.execute-api.us-east-1.amazonaws.com/dev/registration
DELETE
- registration by ID https://tsom3l8zzg.execute-api.us-east-1.amazonaws.com/dev/registration/{id}
swagger: "2.0"
info:
version: "2017-09-04T07:14:01Z"
title: "dev-registration-microservice"
host: "tsom3l8zzg.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/registration:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Registrations"
security:
- 1_0Hd1KoM5a: []
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Registration"
required: true
schema:
$ref: "#/definitions/Registration"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Registration"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/registration/{id}:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Registration"
security:
- 1_0Hd1KoM5a: []
delete:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Registration"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
Registrations:
title: "Registrations"
type: "array"
items:
$ref: "#/definitions/Registration"
Registration:
type: "object"
properties:
studentId:
type: "string"
description: "A unique student identifier."
createdAt:
type: "string"
format: "date-time"
description: "Record creation date (read only)."
paperId:
type: "string"
description: "A unique paper identifier."
status:
type: "string"
description: "Status of the user - active|inactive."
updatedAt:
type: "string"
format: "date-time"
description: "Record update date (read only)."
title: "Registration"
Make sure header content-type is set to application/json
Header Authorization:
N.B. call the Composite Service addRegistration() function to register a student for a new course.
The Room Microservice allows users to create and query classrooms.
POST
GET
- Room by ID https://rcd471phrl.execute-api.us-east-1.amazonaws.com/dev/room/{id}
- Room https://rcd471phrl.execute-api.us-east-1.amazonaws.com/dev/room
swagger: "2.0"
info:
version: "2017-09-04T07:15:15Z"
title: "dev-room-microservice"
host: "rcd471phrl.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/room:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Rooms"
security:
- 1_0Hd1KoM5a: []
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "Room"
required: true
schema:
$ref: "#/definitions/Room"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/Room"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/room/{id}:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Room"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
Room:
type: "object"
properties:
createdAt:
type: "string"
format: "date-time"
description: "Record creation date (read only)."
description:
type: "string"
description: "A unique descriptor for the room."
id:
type: "string"
description: "A unique room identifier."
title: "Room"
Rooms:
title: "Rooms"
type: "array"
items:
$ref: "#/definitions/Room"
Make sure header content-type is set to application/json
Header Authorization:<IdToken>
{
"id": "WT201",
"description": "A class room in the WT building"
}
The User Microservice allows us to create/update/get/list a User from the Attendance application
POST
GET
- user by ID https://fahze41owc.execute-api.us-east-1.amazonaws.com/dev/user/{id}
- https://fahze41owc.execute-api.us-east-1.amazonaws.com/dev/user
PUT
PATCH
DELETE
swagger: "2.0"
info:
version: "2017-09-04T07:16:51Z"
title: "dev-user-microservice"
host: "fahze41owc.execute-api.us-east-1.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/user:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Users"
security:
- 1_0Hd1KoM5a: []
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "User"
required: true
schema:
$ref: "#/definitions/User"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/User"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
/user/{id}:
get:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/User"
put:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "User"
required: true
schema:
$ref: "#/definitions/User"
responses:
201:
description: "201 response"
schema:
$ref: "#/definitions/User"
security:
- 1_0Hd1KoM5a: []
delete:
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/User"
security:
- 1_0Hd1KoM5a: []
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Credentials:
type: "string"
Access-Control-Allow-Headers:
type: "string"
patch:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "User"
required: true
schema:
$ref: "#/definitions/User"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/User"
security:
- 1_0Hd1KoM5a: []
securityDefinitions:
1_0Hd1KoM5a:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
definitions:
User:
type: "object"
properties:
firstName:
type: "string"
lastName:
type: "string"
createdAt:
type: "string"
format: "date-time"
description: "Record creation date (read only)."
id:
type: "string"
description: "A unique user identifier."
type:
type: "string"
description: "Type of user - student | lecturer | administrator"
status:
type: "string"
description: "Status of the user - active|inactive."
updatedAt:
type: "string"
format: "date-time"
description: "Record update date (read only)."
title: "User"
Users:
title: "Users"
type: "array"
items:
$ref: "#/definitions/User"
Make sure header content-type is set to application/json
[
{
"id": "102030",
"firstName": "Julito",
"lastName": "Schwartzenegger",
"type": "administrator",
"status": "active",
"createdAt": "2017-08-31T00:10:38.357Z",
"updatedAt": "2017-08-31T00:10:38.357Z"
},
{
"id": "103460",
"firstName": "Barrack",
"lastName": "Obama",
"type": "student",
"status": "inactive",
"createdAt": "2017-08-31T00:10:38.357Z",
"updatedAt": "2017-08-31T00:10:38.357Z"
}
// Add more user objects if needed
]
{
"id": "102030",
"firstName": "Julito",
"lastName": "Schwartzenegger",
"type": "administrator",
"status": "active",
"createdAt": "2017-08-31T00:10:38.357Z",
"updatedAt": "2017-08-31T00:10:38.357Z"
}
HTTP POST Header Authorization:<IdToken> Request body with "id"
{
"id": "10295765",
"firstName": "Arnold",
"lastName": "Schwarzenegger",
"type": "administrator"
}
Request body no "id" (will be autogenerated)
{
"firstName": "Arnold",
"lastName": "Schwarzenegger",
"type": "administrator"
}
Request body fail Scenario
{
"firstName": "Arnold",
"lastName": "Schwarzenegger",
"type": "trapeze artist"
}
HTTP PUT Header Authorization:<IdToken>
Request body activate user (user id passed in URI)
{
"firstName": "Jack",
"lastName": "Black",
"type": "lecturer",
"status": "active"
}
Request body deactivate user (user id passed in URI)
{
"firstName": "Jack",
"lastName": "Black",
"type": "lecturer",
"status": "inactive"
}
Request body fail scenario (user id passed in URI)
{
"firstName": "Jack",
"lastName": "Black",
"type": "lecturer",
"status": "off"
}
Back | Next