diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..487230b --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,444 @@ +openapi: 3.0.0 +info: + title: OnBase Documents API + description: API for OnBase documents + version: v1 + license: + name: GNU Affero General Public License Version 3 + url: http://www.gnu.org/licenses/agpl-3.0.en.html + contact: + name: IS Data Architecture Team + url: https://is.oregonstate.edu/data-architecture + email: isdataarchitecture@oregonstate.edu +externalDocs: + description: GitHub Repository + url: https://github.com/osu-mist/onbase-docs-api +servers: + - url: https://api.oregonstate.edu/v1 +security: + - OAuth2: + - full +paths: + /onbase-docs: + get: + summary: Get documents + tags: + - onbase-docs + operationId: getDocuments + parameters: + - in: query + name: filter[indexKey] + description: Search documents by index key + required: false + example: 47779366 + schema: + type: integer + - in: query + name: filter[type] + description: Search documents by document type + required: false + example: TEST - Test Documents + schema: + type: string + - in: query + name: filter[typeGroup] + description: Search documents by document type group + required: false + example: TEST + schema: + type: string + - in: query + name: filter[startDocId] + description: Filter documents by minimum document Id + required: false + example: 47779366 + schema: + type: integer + - in: query + name: filter[keywords][hasAll] + description: Filter documents by a list of keywords + required: false + example: DOC - Index Key:999999999|SECKEY - Delete Flag:No + schema: + type: string + pattern: keyword:value|keyword:value + responses: + '200': + description: Successful GET request + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentSetResult' + '400': + $ref: '#/components/responses/400' + '500': + $ref: '#/components/responses/500' + post: + summary: Create a new document + tags: + - onbase-docs + operationId: postDocument + requestBody: + $ref: '#/components/requestBodies/DocumentPostBody' + responses: + '201': + description: Successful creation + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResult' + '409': + $ref: '#/components/responses/409Post' + '500': + $ref: '#/components/responses/500' + /onbase-docs/{id}: + get: + summary: Get a single document + tags: + - onbase-docs + operationId: getDocumentById + parameters: + - $ref: '#/components/parameters/documentId' + responses: + '200': + description: Successful GET request + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResult' + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' + /onbase-docs/{id}/file: + get: + summary: Get a document's file + tags: + - onbase-docs + operationId: getFileByDocumentId + parameters: + - $ref: '#/components/parameters/documentId' + responses: + '200': + description: Successful file request + content: + application/octet-stream: + schema: + type: string + format: binary + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' +components: + securitySchemes: + OAuth2: + type: oauth2 + flows: + clientCredentials: + tokenUrl: 'https://api.oregonstate.edu/oauth2/token' + scopes: + full: Full access to the API + parameters: + pageNumber: + name: 'page[number]' + in: query + required: false + description: Page number of results + schema: + type: integer + minimum: 1 + default: 1 + pageSize: + name: 'page[size]' + in: query + required: false + description: Number of results to return + schema: + type: integer + minimum: 1 + maximum: 500 + default: 25 + documentId: + name: id + in: path + description: The ID of a document + example: 999999999 + required: true + schema: + type: integer + requestBodies: + DocumentPostBody: + required: true + content: + multipart/form-data: + schema: + type: object + required: + - attributes + - file + properties: + attributes: + $ref: '#/components/schemas/DocumentPostResource' + file: + type: string + format: binary + additionalProperties: false + DocumentPatchBody: + description: REPLACEME + required: true + content: + multipart/form-data: + schema: + allOf: + - type: object + properties: + documentFile: + type: string + format: binary + - type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/DocumentPatchResource' + additionalProperties: false + responses: + '400': + description: Bad request + content: &ref_0 + application/json: + schema: + $ref: '#/components/schemas/ErrorResult' + '404': + description: Resource not found + content: *ref_0 + '500': + description: Internal server error + content: *ref_0 + 204Delete: + description: The resource was successfully deleted + 204RelationshipUpdate: + description: The relationship(s) already match the requested state + 409Post: + description: >- + The request body resource object's type was invalid or, if a client-generated ID was used, a + resource already exists with this id + content: *ref_0 + 409Patch: + description: >- + The request body resource object had an invalid type, invalid ID, or violated a uniqueness + constraint + content: *ref_0 + schemas: + SelfLink: + type: object + properties: + self: + type: string + format: uri + description: Self-link of current resource + Meta: + properties: + totalResults: + type: integer + description: Total number of results + example: 10 + totalPages: + type: integer + description: Total number of pages + example: 10 + currentPageNumber: + type: integer + description: Page number of the returned results + example: 1 + currentPageSize: + type: integer + description: Number of results per page + example: 25 + PaginationLinks: + properties: + first: + type: string + format: uri + description: The first page of data + last: + type: string + format: uri + description: The last page of data + prev: + type: string + format: uri + description: The previous page of data + next: + type: string + format: uri + description: The next page of data + ErrorObject: + type: object + properties: + status: + type: string + description: HTTP status code + example: '123' + title: + type: string + description: 'A short, user readable summary of the error' + example: Not Found + code: + type: string + description: An application-specific error code + example: '1234' + detail: + type: string + description: A long description of the error that may contain instance-specific details + links: + type: object + properties: + about: + type: string + format: uri + description: A link to further information about the error + example: 'https://developer.oregonstate.edu/documentation/error-reference#1234' + ErrorResult: + type: object + properties: + errors: + type: array + items: + $ref: '#/components/schemas/ErrorObject' + DocumentId: + type: string + description: Unique ID of document resource + DocumentType: + type: string + enum: + - onbaseDocument + DocumentAttributes: + type: object + properties: + documentType: + type: string + description: Type associated with the document + example: Test - Test Documents + keywords: + type: array + items: + type: object + properties: + name: + type: string + example: DOC - Index Key + value: + type: string + example: 999999999 + DocumentGetAttributes: + allOf: + - $ref: '#/components/schemas/DocumentAttributes' + - type: object + properties: + createdBy: + type: integer + format: int64 + description: Id of profile which created the document + example: 20048 + dateStored: + type: string + format: date-time + description: Date this document was uploaded to onbase + example: '2021-04-28T15:59:22+00:00' + documentDate: + type: string + format: date-time + description: Date associated with the uploaded document + example: '2021-04-28T15:59:22+00:00' + reindexDocumentType: + type: string + description: Holds the final document type while the document goes through the staging process + example: Test - Test Documents + status: + type: string + description: status of this document + example: Active + name: + type: string + description: title of the document + example: 999744823 Brando, Dio, - TEST - Test Documents + id: + type: integer + format: int64 + description: Unique identifier for this document + example: 47779365 + latestAllowedRevisionId: + type: integer + format: int64 + description: Id of profile that last revised the document + example: 20048 + defaultFileType: + type: string + description: Assumed file type for this document + example: PDF + additionalProperties: false + DocumentGetResource: + type: object + properties: + id: + $ref: '#/components/schemas/DocumentId' + type: + $ref: '#/components/schemas/DocumentType' + attributes: + $ref: '#/components/schemas/DocumentGetAttributes' + links: + $ref: '#/components/schemas/SelfLink' + additionalProperties: false + DocumentPostResource: + required: + - DocumentType + - comment + - indexKey + allOf: + - $ref: '#/components/schemas/DocumentAttributes' + - type: object + properties: + fileType: + type: string + description: type of file being uploaded + example: PDF + comment: + type: string + description: Message associated with file upload + example: Test pdf comment + indexKey: + type: string + description: OSU Id associated with this file + example: 999999999 + additionalProperties: false + DocumentPatchResource: + type: object + required: + - type + - id + properties: + type: + $ref: '#/components/schemas/DocumentType' + id: + $ref: '#/components/schemas/DocumentId' + attributes: + $ref: '#/components/schemas/DocumentAttributes' + additionalProperties: false + DocumentResult: + type: object + properties: + links: + $ref: '#/components/schemas/SelfLink' + data: + $ref: '#/components/schemas/DocumentGetResource' + DocumentSetResult: + type: object + properties: + links: + $ref: '#/components/schemas/SelfLink' + data: + type: array + items: + $ref: '#/components/schemas/DocumentGetResource'