{
    "swagger": "2.0",
    "host": "api.dcX.pageuppeople.com",
    "basePath": "/v3/{tenantId}/recruitment",
    "info": {
        "version": "v1",
        "title": "Document API"
    },
    "schemes": [
        "https"
    ],
    "paths": {
        "/document/{id}": {
            "get": {
                "tags": [
                    "Developer Portal: Recruitment > Document"
                ],
                "summary": "Returns metadata about a specific document",
                "description": "Required OAuth scopes for authentication: <b>Public.Document.Read</b>",
                "operationId": "Document_GetPublic",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json",
                    "text/plain",
                    "application/xml",
                    "text/xml"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Document ID to return metadata for",
                        "required": true,
                        "type": "integer",
                        "format": "int32"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Metadata for a specific document",
                        "schema": {
                            "$ref": "#/definitions/PageUp.DTO.v2.Documents.PublicDocument"
                        }
                    },
                    "401": {
                        "description": "No valid authorization token was provided"
                    },
                    "500": {
                        "description": "Failed to get document metadata"
                    }
                }
            }
        },
        "/document/{id}/downloadurl": {
            "get": {
                "tags": [
                    "Developer Portal: Recruitment > Document"
                ],
                "summary": "Returns the URL of the document for download.",
                "description": "Required OAuth scopes for authentication: <b>Public.Document.Read</b>",
                "operationId": "Document_GetPublicDocumentDownloadUrl",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json",
                    "text/plain",
                    "application/xml",
                    "text/xml"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Document ID",
                        "required": true,
                        "type": "integer",
                        "format": "int32"
                    },
                    {
                        "name": "expiresInSeconds",
                        "in": "query",
                        "description": "URL Expiry in seconds (Between 10 to 300 seconds)",
                        "required": false,
                        "type": "integer",
                        "format": "int32",
                        "default": 60
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Document download URL",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "401": {
                        "description": "No valid authorization token was provided"
                    },
                    "500": {
                        "description": "Failed to get document download URL"
                    }
                }
            }
        },
        "/document/prepareTempDirectUpload": {
            "get": {
                "tags": [
                    "Developer Portal: Recruitment > Document"
                ],
                "summary": "Generate a Amazon S3 presigned URL for uploading a document to",
                "description": "Required OAuth scopes for authentication: <b>Public.Document.Write</b>",
                "operationId": "Document_PrepareTempDirectUploadPublic",
                "consumes": [],
                "produces": [
                    "application/json",
                    "text/json",
                    "text/plain",
                    "application/xml",
                    "text/xml"
                ],
                "parameters": [
                    {
                        "name": "fileName",
                        "in": "query",
                        "description": "Filename of the document you intend to upload",
                        "required": true,
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Amazon S3 presigned URL to upload document to, required headers to include in the request, and physical file name to include in subsequent requests",
                        "schema": {
                            "$ref": "#/definitions/PageUp.DTO.v2.DirectUploadInfo"
                        }
                    },
                    "401": {
                        "description": "No valid authorization token was provided"
                    },
                    "500": {
                        "description": "Failed to get Amazon S3 presigned URL"
                    }
                }
            }
        },
        "/document/moveFromTemp": {
            "post": {
                "tags": [
                    "Developer Portal: Recruitment > Document"
                ],
                "summary": "Create new or update existing Document in the PageUp system with a newly uploaded file from Amazon S3 temp storage",
                "description": "Required OAuth scopes for authentication: <b>Public.Document.Write</b>",
                "operationId": "Document_MoveFromTempPublic",
                "consumes": [
                    "application/json",
                    "text/json",
                    "text/plain",
                    "application/xml",
                    "text/xml",
                    "application/x-www-form-urlencoded"
                ],
                "produces": [
                    "application/json",
                    "text/json",
                    "text/plain",
                    "application/xml",
                    "text/xml"
                ],
                "parameters": [
                    {
                        "name": "publicDocument",
                        "in": "body",
                        "description": "Metadata to be saved against the newly uploaded Document. \r\nPhysical file name needs to match that given by previous prepareTempDirectUpload call. \r\nIf an ID is given then the existing file will be replaced with the newly uploaded file, and the new metadata will replace the existing saved values.",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/PageUp.DTO.v2.Documents.PublicDocument"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Document created in the PageUp system for the newly uploaded file",
                        "schema": {
                            "$ref": "#/definitions/PageUp.DTO.v2.Documents.PublicDocument"
                        }
                    },
                    "401": {
                        "description": "No valid authorization token was provided"
                    },
                    "500": {
                        "description": "Failed to move document into the PageUp system"
                    }
                }
            }
        }
    },
    "definitions": {
        "PageUp.DTO.v2.Documents.PublicDocument": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "title": {
                    "type": "string"
                },
                "providerID": {
                    "format": "int32",
                    "type": "integer"
                },
                "fileName": {
                    "type": "string"
                },
                "physicalFile": {
                    "type": "string"
                },
                "documentCategoryName": {
                    "type": "string"
                },
                "documentCategoryId": {
                    "format": "int32",
                    "type": "integer"
                },
                "applicationId": {
                    "format": "int32",
                    "type": "integer"
                },
                "applicantId": {
                    "format": "int32",
                    "type": "integer"
                },
                "jobId": {
                    "format": "int32",
                    "type": "integer"
                },
                "offerId": {
                    "format": "int32",
                    "type": "integer"
                }
            }
        },
        "PageUp.DTO.v2.DirectUploadInfo": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string"
                },
                "contentType": {
                    "type": "string"
                },
                "physicalFile": {
                    "type": "string"
                },
                "headers": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "method": {
                    "type": "string"
                },
                "fallbackUrl": {
                    "type": "string"
                }
            }
        }
    }
}
