{
  "openapi": "3.0.0",
  "info": {
    "title": "REST4i - Administration Services",
    "description": "Administration Services provide APIs that give information about RSE API and the runtime environment of the RSE API server. To use the APIs, the authenticated user must authenticate to localhost and have the administrator role or have *ALLOBJ special authority.",
    "version": "1.0.7-rest4i",
    "contact": {
      "name": "API Support",
      "url": "https://github.com/rest4i"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "/rest4i/api"
    }
  ],
  "tags": [
    {
      "name": "Administration Services",
      "description": "Administration Services provide APIs that give information about RSE API and the runtime environment of the RSE API server. To use the APIs, the authenticated user must authenticate to localhost and have the administrator role or have *ALLOBJ special authority."
    }
  ],
  "paths": {
    "/v1/admin/memory": {
      "get": {
        "tags": ["Administration Services"],
        "summary": "Get information about server memory usage.",
        "description": "Get information about the JVM memory usage of the server running RSE API.",
        "operationId": "adminGetMemoryUsage",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request.",
            "content": {
              "application/json": {
                "example": {
                  "jvmFreeMemory": 17428920,
                  "jvmMaxMemory": 4294967296,
                  "jvmTotalMemory": 78249984
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      }
    },
    "/v1/admin/settings": {
      "get": {
        "tags": ["Administration Services"],
        "summary": "Get the general settings being used for RSE API.",
        "description": "The settings are global in nature and include settings for tuning, environment, and administrator override categories.",
        "operationId": "adminGetSettings",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request.",
            "content": {
              "application/json": {
                "example": {
                  "adminUsers": ["USER1", "USER2"],
                  "includeUsers": ["USER1", "USER2"],
                  "excludeUsers": [],
                  "maxFileSize": 3072000,
                  "maxSessionInactivity": 7200,
                  "maxSessionLifetime": 21600,
                  "maxSessionUseCount": 1000,
                  "maxSessionWaitTime": 300,
                  "maxSessions": 100,
                  "maxSessionsPerUser": 20,
                  "sessionCleanupInterval": 300
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      },
      "post": {
        "tags": ["Administration Services"],
        "summary": "Set settings for RSE API.",
        "description": "The settings are global in nature and include settings for tuning, environment, and administrator override categories.",
        "operationId": "adminSetSettings",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The settings for RSE API.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/rest4i_Settings"
              },
              "example": {
                "persist": false,
                "adminUsers": ["USER1", "USER2"],
                "includeUsers": ["USER1", "USER2"],
                "excludeUsers": [],
                "maxFileSize": 3072000,
                "maxSessionInactivity": 7200,
                "maxSessionLifetime": 21600,
                "maxSessionUseCount": 1000,
                "maxSessionWaitTime": 300,
                "maxSessions": 100,
                "maxSessionsPerUser": 20,
                "sessionCleanupInterval": 300
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful request, no content."
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      }
    },
    "/v1/admin/environment": {
      "get": {
        "tags": ["Administration Services"],
        "summary": "Get information about server environment.",
        "description": "Get information about server environment, such as host, operating system, Java version, and port.",
        "operationId": "adminGetEnvironment",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request.",
            "content": {
              "application/json": {
                "example": {
                  "rest4iBasepath": "rest4i",
                  "rest4iHostname": "UT30P44",
                  "rest4iPort": 2012,
                  "rest4iVersion": "1.0.6",
                  "osName": "OS/400",
                  "osVersion": "V7R5M0",
                  "javaVersion": "1.8.0_351"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      }
    },
    "/v1/admin/serverinfo": {
      "get": {
        "tags": ["Administration Services"],
        "summary": "Get server information.",
        "description": "Get basic server information including hostname, port, version, and base path.",
        "operationId": "adminGetServerInfo",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request.",
            "content": {
              "application/json": {
                "example": {
                  "rest4iBasepath": "rest4i",
                  "rest4iHostname": "UT30P44",
                  "rest4iPort": 2012,
                  "rest4iVersion": "1.0.6"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      }
    },
    "/v1/admin/sessions": {
      "get": {
        "tags": ["Administration Services"],
        "summary": "Get information about sessions.",
        "description": "Get information about sessions. The information that is returned applies to active sessions on the server. Active sessions may include sessions that are expired but have not been reclaimed by RSE API.",
        "operationId": "adminGetSessions",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful request.",
            "content": {
              "application/json": {
                "example": {
                  "totalSessions": 3,
                  "sessions": [
                    {
                      "userid": "USER1",
                      "sessionCount": 1
                    },
                    {
                      "userid": "USER2",
                      "sessionCount": 2
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      },
      "delete": {
        "tags": ["Administration Services"],
        "summary": "Delete sessions.",
        "description": "Delete sessions. You can delete all active sessions or only sessions tied to a user ID. Sessions that are deleted are marked as expired.",
        "operationId": "adminClearSessions",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "The authorization HTTP header.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "query",
            "description": "The session(s) to delete. Specify the user ID to delete all sessions created by the user, or the special value of *ALL to delete all sessions for all users.",
            "schema": {
              "type": "string",
              "default": "*ALL"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful request, no content."
          },
          "401": {
            "description": "Unauthorized request was made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request is forbidden.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unable to process the request due to an internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerHttpAuthentication": []
          },
          {
            "basicHttpAuthentication": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "rest4i_Settings": {
        "type": "object",
        "properties": {
          "persist": {
            "type": "boolean",
            "description": "Save settings to property file in persistent storage (hard disk).",
            "default": false
          },
          "adminUsers": {
            "type": "array",
            "description": "User IDs that will be designated as an RSE API administrator.",
            "items": {
              "type": "string"
            }
          },
          "includeUsers": {
            "type": "array",
            "description": "User IDs allowed to use RSE API.",
            "items": {
              "type": "string"
            }
          },
          "excludeUsers": {
            "type": "array",
            "description": "User IDs not allowed to use RSE API.",
            "items": {
              "type": "string"
            }
          },
          "maxFileSize": {
            "maximum": 15360000,
            "minimum": 0,
            "type": "integer",
            "description": "Maximum size of IFS file data that can be processed (reading or writing) by RSE API.",
            "format": "int64",
            "default": 3072000
          },
          "maxSessions": {
            "minimum": -1,
            "type": "integer",
            "description": "Maximum number of total sessions. The value of -1 indicates there is no limit.",
            "format": "int64",
            "default": 100
          },
          "maxSessionsPerUser": {
            "type": "integer",
            "description": "Maximum number of sessions allowed on a per-user basis. The value of -1 indicates there is no limit.",
            "format": "int64",
            "default": 20
          },
          "maxSessionInactivity": {
            "maximum": 7200,
            "minimum": 30,
            "type": "integer",
            "description": "Maximum amount of inactive time, in seconds, before an available session is invalidated.",
            "format": "int64",
            "default": 7200
          },
          "maxSessionLifetime": {
            "type": "integer",
            "description": "Maximum life, in seconds, for a session. The value of -1 indicates there is no limit.",
            "format": "int64",
            "default": -1
          },
          "maxSessionUseCount": {
            "type": "integer",
            "description": "Maximum number of times a session can be used before it is invalidated. The value of -1 indicates there is no limit.",
            "format": "int64",
            "default": -1
          },
          "maxSessionWaitTime": {
            "minimum": -1,
            "type": "integer",
            "description": "Maximum time, in seconds, to wait on a session to become available. The value of -1 indicates there is no limit.",
            "format": "int64",
            "default": 300
          },
          "sessionCleanupInterval": {
            "maximum": 900,
            "minimum": 30,
            "type": "integer",
            "description": "The time interval, in seconds, for how often the session maintenance daemon is run.",
            "format": "int64",
            "default": 300
          }
        },
        "description": "Global settings for RSE API."
      },
      "Problem": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "details": {
            "type": "object"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerHttpAuthentication": {
        "type": "http",
        "description": "Bearer token authentication.",
        "scheme": "bearer",
        "bearerFormat": "Bearer [token]"
      },
      "basicHttpAuthentication": {
        "type": "http",
        "description": "Basic authentication.",
        "scheme": "basic"
      }
    }
  }
}
