208 lines
6.3 KiB
JSON
208 lines
6.3 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "REST4i - SQL Services",
|
|
"description": "SQL Services provide APIs associated with performing SQL operations.",
|
|
"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": "SQL Services",
|
|
"description": "SQL Services provide APIs associated with performing SQL operations."
|
|
}
|
|
],
|
|
"paths": {
|
|
"/v1/sql": {
|
|
"put": {
|
|
"tags": ["SQL Services"],
|
|
"summary": "Run a SQL statement on the server.",
|
|
"description": "Run a SQL statement on the server. If SQL statement fails, any messages relating to the error is returned. SQL state information is returned only if errors are detected. You have the option of indicating whether the state information is returned on all responses. By default, if a SQL statement is run successfully and there is no result set to return, no data is returned in the response.",
|
|
"operationId": "runSQLStatements",
|
|
"parameters": [
|
|
{
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"description": "The authorization HTTP header.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "The SQL statement to be run on the server.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/rest4i_SQLRequest"
|
|
},
|
|
"example": {
|
|
"alwaysReturnSQLStateInformation": false,
|
|
"treatWarningsAsErrors": false,
|
|
"sqlStatement": "select * from QIWS.QCUSTCDT"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "SQL statements(s) issued.",
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"resultSet": [
|
|
{
|
|
"CUSNUM": 938472,
|
|
"LSTNAM": "Henning",
|
|
"INIT": "G K",
|
|
"STREET": "4859 Elm Ave",
|
|
"CITY": "Dallas",
|
|
"STATE": "TX",
|
|
"ZIPCOD": 75217,
|
|
"CDTLMT": 5000,
|
|
"CHGCOD": 3,
|
|
"BALDUE": 37,
|
|
"CDTDUE": 0
|
|
},
|
|
{
|
|
"CUSNUM": 839283,
|
|
"LSTNAM": "Jones",
|
|
"INIT": "B D",
|
|
"STREET": "21B NW 135 St",
|
|
"CITY": "Clay",
|
|
"STATE": "NY",
|
|
"ZIPCOD": 13041,
|
|
"CDTLMT": 400,
|
|
"CHGCOD": 1,
|
|
"BALDUE": 100,
|
|
"CDTDUE": 0
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"204": {
|
|
"description": "SQL statement(s) issued successfully, 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": []
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"rest4i_SQLRequest": {
|
|
"required": ["sqlStatement"],
|
|
"type": "object",
|
|
"properties": {
|
|
"alwaysReturnSQLStateInformation": {
|
|
"type": "boolean",
|
|
"description": "Always return SQL state information. Default value is whatever has been set for the session."
|
|
},
|
|
"treatWarningsAsErrors": {
|
|
"type": "boolean",
|
|
"description": "Treat SQL warnings as errors. Default value is whatever has been set for the session."
|
|
},
|
|
"sqlStatement": {
|
|
"type": "string",
|
|
"description": "The SQL statement to be run."
|
|
}
|
|
},
|
|
"description": "SQL request to run."
|
|
},
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
}
|