resources-manager-api/docs/resources-manager.yml

270 lines
6.2 KiB
YAML
Raw Normal View History

2019-12-02 23:18:00 +01:00
swagger: "2.0"
info:
2019-12-03 21:30:47 +01:00
description: "Resources Manager API"
2019-12-02 23:18:00 +01:00
version: "1.0.0"
2019-12-03 22:50:06 +01:00
title: "Resources Manager API"
2019-12-03 21:30:47 +01:00
host: "localhost"
2019-12-02 23:18:00 +01:00
basePath: "/api"
tags:
2019-12-03 21:30:47 +01:00
- name: "user"
description: "Operations about user"
2019-12-03 22:20:51 +01:00
- name: "session"
description: "logon and log out methods to get a token"
2019-12-02 23:18:00 +01:00
schemes:
- "https"
paths:
2019-12-03 21:30:47 +01:00
/user:
2019-12-02 23:18:00 +01:00
post:
tags:
2019-12-03 21:30:47 +01:00
- "user"
summary: "Create user"
description: "Need pass an api key to authentificate."
produces:
2019-12-02 23:18:00 +01:00
- "application/json"
2019-12-03 21:30:47 +01:00
parameters:
- in: "body"
name: "body"
description: "Created user object"
required: true
schema:
$ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses:
default:
description: "successful operation"
2019-12-03 22:20:51 +01:00
401:
description: Authentification failed
403:
description: You are not allowed to do that
2019-12-03 21:30:47 +01:00
/user/createWithList:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses:
default:
description: "successful operation"
2019-12-03 22:20:51 +01:00
401:
description: Authentification failed
403:
description: You are not allowed to do that
2019-12-03 21:30:47 +01:00
/user/{username}:
2019-12-02 23:18:00 +01:00
get:
tags:
2019-12-03 21:30:47 +01:00
- "user"
summary: "Get user by user name"
description: ""
2019-12-02 23:18:00 +01:00
produces:
- "application/json"
parameters:
2019-12-03 21:30:47 +01:00
- name: "username"
in: "path"
description: "The name that needs to be fetched."
2019-12-02 23:18:00 +01:00
required: true
2019-12-03 21:30:47 +01:00
type: "string"
- in: header
name: X-API-Key
2019-12-02 23:18:00 +01:00
type: string
2019-12-03 21:30:47 +01:00
required: false
2019-12-02 23:18:00 +01:00
responses:
200:
2019-12-03 21:30:47 +01:00
description: "successful operation"
2019-12-02 23:18:00 +01:00
schema:
2019-12-03 22:20:51 +01:00
$ref: "#/definitions/UserInfo"
2019-12-03 21:30:47 +01:00
400:
description: "Invalid username supplied"
404:
description: "User not found"
2019-12-03 22:20:51 +01:00
401:
description: Authentification failed
403:
description: You are not allowed to do that
2019-12-03 21:30:47 +01:00
put:
2019-12-02 23:18:00 +01:00
tags:
2019-12-03 21:30:47 +01:00
- "user"
summary: "Updated user"
description: "This can only be done by the logged in user."
2019-12-02 23:18:00 +01:00
produces:
- "application/json"
parameters:
2019-12-03 21:30:47 +01:00
- name: "username"
in: "path"
description: "name that need to be updated"
2019-12-02 23:18:00 +01:00
required: true
2019-12-03 21:30:47 +01:00
type: "string"
2019-12-02 23:18:00 +01:00
- in: "body"
name: "body"
2019-12-03 21:30:47 +01:00
description: "Updated user object"
2019-12-02 23:18:00 +01:00
required: true
schema:
2019-12-03 21:30:47 +01:00
$ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
2019-12-02 23:18:00 +01:00
responses:
2019-12-03 21:30:47 +01:00
400:
description: "Invalid user supplied"
404:
description: "User not found"
2019-12-03 22:20:51 +01:00
401:
description: Authentification failed
403:
description: You are not allowed to do that
2019-12-03 21:30:47 +01:00
delete:
tags:
- "user"
summary: "Delete user"
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be deleted"
required: true
type: "string"
- in: header
name: X-API-Key
type: string
required: true
responses:
400:
description: "Invalid username supplied"
404:
description: "User not found"
2019-12-03 22:20:51 +01:00
401:
description: Authentification failed
403:
description: You are not allowed to do that
/session:
get:
tags:
- session
summary: "Get current session info"
parameters:
- in: header
name: X-API-Key
type: string
required: true
responses:
401:
description: Authentification failed
200:
description: "successful operation"
schema:
$ref: "#/definitions/Session"
post:
tags:
- session
summary: "Try to auth and retrive an api key"
parameters:
- in: "body"
name: "body"
description: "auth"
required: true
schema:
$ref: "#/definitions/InternalAuth"
responses:
401:
description: Authentification failed
200:
description: "successful operation"
schema:
$ref: "#/definitions/Session"
2019-12-02 23:18:00 +01:00
definitions:
2019-12-03 21:30:47 +01:00
User:
2019-12-02 23:18:00 +01:00
type: "object"
properties:
id:
2019-12-03 21:30:47 +01:00
type: "integer"
format: "int64"
username:
type: "string"
firstName:
type: "string"
lastName:
type: "string"
email:
type: "string"
password:
type: "string"
2019-12-03 22:20:51 +01:00
format: "password"
2019-12-03 21:30:47 +01:00
phone:
type: "string"
userStatus:
type: "integer"
format: "int32"
2019-12-03 22:20:51 +01:00
description: "User Status"
authMethod:
type: "string"
pattern: '^(internal|ldap|cas)$'
UserInfo:
type: "object"
properties:
id:
type: "integer"
format: "int64"
username:
type: "string"
firstName:
type: "string"
lastName:
type: "string"
email:
type: "string"
phone:
type: "string"
userStatus:
type: "integer"
format: "int32"
description: "User Status"
authMethod:
type: "string"
pattern: '^(internal|ldap|cas)$'
lastConnect:
type: "string"
format: date-time
Session:
type: "object"
properties:
user:
type: object
createDate:
type: string
format: date-time
endDate:
type: string
format: date-time
X-API-Key:
type: string
InternalAuth:
type: "object"
properties:
username:
type: "string"
password:
type: "string"
format: password