Uploading Files Using an API
Overview
When uploading files using an API for content, forms, members, etc., you can use the Files::upload
endpoint to upload the file to Kuroco's temporary storage and then POST the returned file_id
to update the content in each endpoint.
To confirm the functionality using SwaggerUI, follow the steps below.
Steps
Upload the file to the
Files::upload
endpoint.
Open theFiles::upload
endpoint and click the [Select File] button to choose the file to upload.tipSpecify 'Content-Type': 'multipart/form-data' in the request header when sending the file.
Confirm the
file_id
from the response.
Once the upload to the temporary storage is successful, the response containing thefile_id
will be displayed.POST the
file_id
to the endpoint for updating the content.
Send a request to the endpoint that handles the content you want to update or add, specifying thefile_id
.infoIn the example capture, a request is sent to
Member::update
. In the HTML of the HTML item and Wysiwyg item of the content that path will also be updated if there are img/a tags like <img src="https://[KurocoFiles host]/files/temp/**.jpg">Confirm that the request was successful.
Check the response and the content.
Please refer to the related documentation for specific code examples in the frontend.
Related Documentation
Support
If you have any other questions, please contact us or check out Our Slack Community.