This project provides an API for handling file uploads, image retrieval, caption generation, and Instagram carousel posting.
Endpoint: /split_upload
Method: POST
Controller: AwsS3Controller@handleUploadS3
Splits files into multiple parts and upload them to AWS S3 Bucket.
- Headers:
Content-Type: multipart/form-data
- Body:
carouselFiles[](array of files): The files to be uploaded.dirName(string): The directory name where the files will be stored.numberOfParts(integer, optional): The number of parts to split the files into.
- Success:
{ "message": "Files uploaded successfully.", "data": ["part1.jpg", "part2.jpg", "part3.jpg"] } - Error:
{ "error": "Failed to upload files." }
Endpoint: /bucket/parts
Method: GET
Controller: AwsS3Controller@showImages
Retrieves a list of images stored in the AWS S3 bucket.
- Headers: None
- Query Parameters:
dirName(string, optional): The directory name to filter images.
- Success:
{ "message": "Images retrieved successfully.", "data": ["image1.jpg", "image2.jpg", "image3.jpg"] } - Error:
{ "error": "Failed to retrieve images." }
Endpoint: /caption/completion
Method: POST
Controller: ChatCompletionController@generatePostCaption
Generates a caption for a post using AI.
- Headers:
Content-Type: application/json
- Body:
prompt(string): The input text to generate the caption.
- Success:
{ "message": "Caption generated successfully.", "data": "This is the generated caption." } - Error:
{ "error": "Failed to generate caption." }
Endpoint: /post/carousel
Method: POST
Controller: CarouselPostController@postInstagramCarousel
Posts a carousel of images to Instagram.
- Headers:
Content-Type: application/json
- Body:
images(array of strings): The list of image URLs to post.caption(string): The caption for the post.
- Success:
{ "message": "Carousel posted successfully.", "data": { "postId": "1234567890" } } - Error:
{ "error": "Failed to post carousel." }
- Ensure that the AWS S3 credentials and configurations are properly set up in the environment variables.
- The AI caption generation feature requires an API key for the AI service (OpenAI).
AWS_ACCESS_KEY_ID: AWS access key.AWS_SECRET_ACCESS_KEY: AWS secret key.AWS_BUCKET_NAME: Name of the S3 bucket.NEXT_PUBLIC_API_URL: Base URL for the API.