Xano allows for a wide range of files to get uploaded using the API. There are 3 different categories of files that can be processed: Images, Videos, and Attachments. (Note: Audio files such as mp3 should be treated as Attachments). There is a generic file uploader that can be used as an input for your API to create the metadata for each category.
In this example, we will use the "file" input to see what happens when we create different metadata.
Xano also accepts base64 encoded files and URLs as inputs. You are able to paste in a base64 encoded file or URL directly into the Debugger in Xano. However, if you wish to upload a file as the input, then you need to use Swagger. Example using a file uploader:
1. Set up the API request: We will create a custom API with the verb POST. (Note: Xano has a prebuilt Endpoint you can add called Upload Content, which accomplishes the below set up).
2. Then set up the Input: We will add the File Input which is in the Storage field type.
3. There are 3 options we can use for our Function Stack: Create Image Metadata.
Create Video Metadata.
Create Attachment Metadata.
4. We add our Response:
6. After uploading an image, this is the Metadata response from the "create image" API.
Example using an image URL:
Below we have the same API endpoint set up: The input type is a file and the function is creating the metadata.
However, in this example, we are inputting the image URL directly into the Debugger.
The result will show the image metadata for the inputted image: