mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-26 03:11:34 +01:00
mvp file to ingress fn
This commit is contained in:
33
data/55340b32-e38e-48ed-b472-902c3144fe70/changes.md
Normal file
33
data/55340b32-e38e-48ed-b472-902c3144fe70/changes.md
Normal file
@@ -0,0 +1,33 @@
|
||||
Your proposed structure for the API sounds solid and modular, making it easier to manage files and their relationships with other data. Here’s a breakdown of how this can work and how it could be used with an iOS shortcut or a custom application:
|
||||
|
||||
API Structure
|
||||
File Management Endpoints:
|
||||
|
||||
POST /file: Accepts a file upload and returns a unique identifier (ID) for that file.
|
||||
PUT /file/{id}: Updates the metadata of the file identified by {id}.
|
||||
DELETE /file/{id}: Deletes the file and its associated metadata from the database.
|
||||
Data Ingress Endpoint:
|
||||
|
||||
POST /ingress: Accepts a JSON body containing references (IDs) to files and other necessary data, linking them in the database as needed.
|
||||
Using with iOS Shortcuts
|
||||
You can create shortcuts to interact with your API endpoints without the need for a full-fledged application. Here's how:
|
||||
|
||||
File Upload Shortcut:
|
||||
|
||||
Use the "Get File" action to select a file from the device.
|
||||
Use the "Post" action to send a multipart/form-data request to the /file endpoint.
|
||||
Parse the response to get the returned file ID.
|
||||
Data Ingress Shortcut:
|
||||
|
||||
Use the "Ask for Input" action to gather the necessary fields for the ingress (like instructions, category, etc.) and the file ID(s).
|
||||
Use another "Post" action to send this data to the /ingress endpoint as JSON.
|
||||
Developing a CLI Tool
|
||||
A CLI tool could also be developed for easier interaction with your API. This tool could:
|
||||
|
||||
Upload Files: Handle file uploads and return file IDs.
|
||||
Link Data: Accept user input for instructions, category, and linked file IDs, then submit this data to the /ingress endpoint.
|
||||
Additional Considerations
|
||||
Error Handling: Ensure that both the upload and ingress endpoints handle errors gracefully and provide meaningful messages.
|
||||
Documentation: Create clear API documentation to guide users in constructing requests correctly, whether they are using a shortcut, CLI, or custom application.
|
||||
Authentication: Consider adding authentication to your API endpoints for security, especially if sensitive data is being handled.
|
||||
This approach gives you the flexibility to support various clients, streamline interactions, and keep the server-side implementation clean and manageable. Would you like more specifics on any part of this setup?
|
||||
Reference in New Issue
Block a user