Create Media
For creating a new Media you need to use the createMedia
and provide a valid file path, file type, and file name.
Allowed file types are (jpeg, gif, png , jpg, pdf)
Create Media Example
Check the example:
import { uploadMedia } from 'react-native-altibbi';
uploadMedia("file://pathToFile.csv", 'application/pdf', 'fileName.csv').then((res) => {
setImageID(res?.data?.id);
});
Responses
Status 200
Success
{
"id": "1234123",
"type": "image",
"name": "Test file",
"path": "doc/2024/02/05/60037901f47939872a6e1bdb9a65f604.png",
"extention": "png",
"size": "362875",
"url": "https://altibbi.com/Medias/12123/2331.png"
}
Status 401
UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\\\web\\\\UnauthorizedHttpException"
}
Status 422
Data Validation Failed.
[
{
"field": "string",
"message": "string"
}
]