Skip to content
Snippets Groups Projects
users-api.yaml 6.96 KiB
Newer Older
  • Learn to ignore specific revisions
  • {
      "openapi": "3.0.1",
      "info": {
        "title": "OpenAPI definition",
        "version": "v0"
      },
      "servers": [
        {
          "url": "https://192.168.75.68:8443/authServer",
          "description": "Generated server url"
        }
      ],
      "paths": {
        "/users/{id}": {
          "get": {
            "tags": [
              "user-rest-controller"
            ],
            "summary": "Get user informations by id",
            "operationId": "getUserAsJsonOrXml",
            "parameters": [
              {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Found the user",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "application/xml": {
                    "schema": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "text/html": {}
                }
              },
              "404": {
                "description": "User not found"
              }
            }
          },
          "put": {
            "tags": [
              "user-rest-controller"
            ],
            "summary": "Modify password of a user by its id",
            "operationId": "modifyUserPassword",
            "parameters": [
              {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              {
                "name": "new_password",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "204 No Content": {
                "description": "Password is correctly modified"
              },
              "404 Not Found": {
                "description": "default response"
              },
              "500 Internal Server Error": {
                "description": "default response"
              }
            }
          },
          "delete": {
            "tags": [
              "user-rest-controller"
            ],
            "summary": "Delete a user on the database, by its id",
            "operationId": "deleteUser",
            "parameters": [
              {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "404 Not Found": {
                "description": "default response"
              },
              "500 Internal Server Error": {
                "description": "default response"
              },
              "204 No Content": {
                "description": "User deleted with success"
              }
            }
          }
        },
        "/users": {
          "post": {
            "tags": [
              "user-rest-controller"
            ],
            "summary": "Create a new user",
            "operationId": "createUserFromUrlEncoded_1",
            "parameters": [
              {
                "name": "login",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              {
                "name": "password",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "requestBody": {
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/User"
                  }
                }
              },
              "required": true
            },
            "responses": {
              "403 Forbidden": {
                "description": "User not created"
              },
              "500 Internal Server Error": {
                "description": "default response"
              },
              "201 Created": {
                "description": "User is correctely created",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "application/xml": {
                    "schema": {
                      "$ref": "#/components/schemas/User"
                    }
                  },
                  "text/html": {}
                }
              }
            }
          }
        },
        "/logout": {
          "post": {
            "tags": [
              "user-operations"
            ],
            "summary": "Réalise la déconnexion.",
            "operationId": "logout",
            "parameters": [
              {
                "name": "login",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "204 No Content": {
                "description": "User succesfully logged out"
              },
              "401 Unauthorized": {
                "description": "default response"
              }
            }
          }
        },
        "/login": {
          "post": {
            "tags": [
              "user-operations"
            ],
            "summary": "login utilisée par un utilisateur",
            "operationId": "login",
            "parameters": [
              {
                "name": "login",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              {
                "name": "password",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              {
                "name": "Origin",
                "in": "header",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "204 No Content": {
                "description": "User succesfully logged in"
              },
              "401 Unauthorized": {
                "description": "Login failed"
              }
            }
          }
        },
        "/authenticate": {
          "get": {
            "tags": [
              "user-operations"
            ],
            "summary": "Méthode destinée au serveur Node pour valider l'authentification d'un utilisateur.",
            "operationId": "authenticate",
            "parameters": [
              {
                "name": "Authorization",
                "in": "header",
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              {
                "name": "origin",
                "in": "query",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "responses": {
              "204 No Content": {
                "description": "default response"
              }
            }
          }
        }
      },
      "components": {
        "schemas": {
          "User": {
            "type": "object",
            "properties": {
              "login": {
                "type": "string"
              },
              "password": {
                "type": "string",
                "writeOnly": true
              },
              "connected": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }