Usage
Cllouda API

Cllouda API

We recommend using the API only when the SDK cannot be used in your environment due to language constraints or other factors. Below is an example of how to interact with our API.

Usage

libs/cllouda.ts
    const url = 'https://cllouda-api.azwedo.com/api/file/upload'
 
    const options = {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            token: 'YOUR_API_KEY',
            data: {
                fileBase64: 'BASE64_STRING',
                fileName: 'FILENAME',
                fileType: 'FILE_TYPE'
            }
        })
    }
 
    const req = await fetch(url, options)
    const res = await req.json()
 
    if (res) {
        const { success, data, message } = res
 
        if (success && data) {
            const { publicFileUrl } = data
 
            // Do something with the data
        }
 
        else {
            console.error(message)
 
            // Handle the error case, you can use our message to show the user
        }
    }

API is designed to work only in server environments because of the token we provide. This token must not be exposed, as it would allow other people to access your account.

Request

token is the token we provide you.
data is the object contains the data about your file.

Response

success is a boolean that tells you if the request was successful.
message is a string that tells you what happened.
data is an object that contains the data you requested if the request was successful.
data?.publicFileUrl is the URL of the uploaded file, this never expires.

Currently we only accept: .webp, .jpeg, .jpg, .png file types while working on 10+ more formats.