I am working on a custom GPT 4 application within chatGPT and in the configure tab there is a place where you can implement some OpenAPI schemas.
I am trying to simply make a PUT request to move an uploaded file (.pdf) into an S3 bucket.
I successfully connect to the API but when I look in S3, the file is either empty or has some small amount of info about the document inside.
i.e.
{"metadata": {"name": "Manual", "description": "A comprehensive manual for Capri, including important contact numbers, other information, instructions, recommendations, and FAQs."}, "fileData": "/mnt/data/test.pdf"}
Can someone please help me understand if what I am trying to do is possible and how I may do that? I tried the API in POSTMAN and the response was 200 and the file was in its original format.
I tried postman and it worked fine; as soon as I try to bring it into OpenAPI schema, I lose....
Here is my schema code:
{
"openapi": "3.1.0",
"info": {
"title": "S3 Bucket File Management API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://HIDDEN.execute-api.us-east-1.amazonaws.com/prod"
}
],
"paths": {
"/bnb-bucket-ham/{filename}": {
"put": {
"summary": "Upload a file to the S3 bucket",
"operationId": "uploadFile",
"parameters": [
{
"name": "filename",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"metadata": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["name"]
},
"fileData": {
"type": "string",
"format": "byte"
}
},
"required": ["metadata", "fileData"]
}
},
"application/pdf": {},
"application/msword": {},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {}
}
},
"responses": {
"200": {
"description": "File uploaded successfully"
}
}
},
"get": {
"summary": "Retrieve a file from the S3 bucket",
"operationId": "getFile",
"parameters": [
{
"name": "filename",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "File retrieved successfully",
"content": {
"application/pdf": {
"schema": {
"type": "string",
"format": "binary"
}
},
"application/msword": {
"schema": {
"type": "string",
"format": "binary"
}
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"404": {
"description": "File not found"
}
}
}
}
}
}