Référence API pour les développeurs v3

Commencer

Une clé API est requise pour que les demandes soient traitées par le système. Une fois qu'un utilisateur s'inscrit, une clé API est automatiquement générée pour cet utilisateur. La clé API doit être envoyée avec chaque requête (voir exemple complet ci-dessous). Si la clé API n'est pas envoyée ou a expiré, il y aura une erreur. Assurez-vous de garder votre clé API secrète pour éviter les abus.

Authentification

Pour vous authentifier auprès du système API, vous devez envoyer votre clé API en tant que jeton d'autorisation avec chaque demande. Vous pouvez voir un exemple de code ci-dessous.

curl --location --request POST 'https://uto.la/api/url/add' \ 
--header 'Authorization: Bearer YOURAPIKEY
--header 'Content-Type: application/json' \ 
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/url/add",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOURAPIKEY",
    "Content-Type: application/json",
    ),
));

$response = curl_exec($curl);
Limite de taux

Notre API dispose d'un limiteur de débit pour se protéger contre les pics de demandes afin de maximiser sa stabilité. Notre limiteur de débit est actuellement limité à 30 requêtes par 1 minute.

Plusieurs en-têtes seront envoyés avec la réponse et ceux-ci peuvent être examinés pour déterminer diverses informations sur la demande.

X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: TIMESTAMP
Gestion des réponses

Toutes les réponses de l'API sont renvoyées au format JSON par défaut. Pour convertir cela en données utilisables, la fonction appropriée devra être utilisée en fonction de la langue. En PHP, la fonction json_decode() peut être utilisée pour convertir les données en objet (par défaut) ou en tableau (définissez le deuxième paramètre sur true). Il est très important de vérifier la clé d'erreur car elle indique s'il y a eu une erreur ou non. Vous pouvez également vérifier le code d'en-tête.

{
    "error": 1,
    "message": "An error ocurred"
}

Compte

Obtenir un compte
GET https://uto.la/api/account

Pour obtenir des informations sur le compte, vous pouvez envoyer une demande à ce point de terminaison et il renverra des données sur le compte.

curl --location --request GET 'https://uto.la/api/account' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/account",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "data": {
        "id": 1,
        "email": "sample@domain.com",
        "username": "sampleuser",
        "avatar": "https:\/\/domain.com\/content\/avatar.png",
        "status": "pro",
        "expires": "2022-11-15 15:00:00",
        "registered": "2020-11-10 18:01:43"
    }
}
Compte mis à jour
PUT https://uto.la/api/account/update

Pour mettre à jour les informations sur le compte, vous pouvez envoyer une demande à ce point de terminaison et il mettra à jour les données sur le compte.

curl --location --request PUT 'https://uto.la/api/account/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "newemail@google.com",
    "password": "newpassword"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/account/update",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    CURLOPT_POSTFIELDS => '{
    "email": "newemail@google.com",
    "password": "newpassword"
}',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "Account has been successfully updated."
}

Liens


Codes QR

Lister tous les codes QR
GET https://uto.la/api/qr?limit=2&page=1

Pour obtenir vos codes QR via l'API, vous pouvez utiliser ce point de terminaison. Vous pouvez également filtrer les données (Voir le tableau pour plus d'informations).

ParamètreLa description
limit (optional) Per page data result
page (optional) Current page request
curl --location --request GET 'https://uto.la/api/qr?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/qr?limit=2&page=1",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": "0",
    "data": {
        "result": 2,
        "perpage": 2,
        "currentpage": 1,
        "nextpage": 1,
        "maxpage": 1,
        "qrs": [
            {
                "id": 2,
                "link": "https:\/\/uto.la\/qr\/a2d5e",
                "scans": 0,
                "title": "Google",
                "date": "2020-11-10 18:01:43"
            },
            {
                "id": 1,
                "link": "https:\/\/uto.la\/qr\/b9edfe",
                "scans": 5,
                "title": "Google Canada",
                "date": "2020-11-10 18:00:25"
            }
        ]
    }
}
Obtenez un seul code QR
GET https://uto.la/api/qr/:id

Pour obtenir les détails d'un seul code QR via l'API, vous pouvez utiliser ce point de terminaison.

curl --location --request GET 'https://uto.la/api/qr/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/qr/:id",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "details": {
        "id": 1,
        "link": "https:\/\/uto.la\/qr\/b9edfe",
        "scans": 5,
        "title": "Google Canada",
        "date": "2020-11-10 18:00:25"
    },
    "data": {
        "clicks": 1,
        "uniqueClicks": 1,
        "topCountries": {
            "Unknown": "1"
        },
        "topReferrers": {
            "Direct, email and other": "1"
        },
        "topBrowsers": {
            "Chrome": "1"
        },
        "topOs": {
            "Windows 10": "1"
        },
        "socialCount": {
            "facebook": 0,
            "twitter": 0,
            "instagram": 0
        }
    }
}
Créer un code QR
POST https://uto.la/api/qr/add

Pour raccourcir un QR Code, vous devez envoyer une donnée valide en JSON via une requête POST. Les données doivent être envoyées en tant que corps brut de votre demande, comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).

ParamètreLa description
type (required) text | vcard | link | email | phone | sms | wifi
data (required) Data to be embedded inside the QR code. The data can be string or array depending on the type
background (optional) RGB color e.g. rgb(255,255,255)
foreground (optional) RGB color e.g. rgb(0,0,0)
logo (optional) Path to the logo either png or jpg
curl --location --request POST 'https://uto.la/api/qr/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/qr/add",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    CURLOPT_POSTFIELDS => '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png"
}',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "id": 3,
    "link": "https:\/\/uto.la\/qr\/a58f79"
}
Mettre à jour un code QR
PUT https://uto.la/api/qr/:id/update

Pour mettre à jour un QR Code, vous devez envoyer une donnée valide en JSON via une requête PUT. Les données doivent être envoyées en tant que corps brut de votre demande, comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).

ParamètreLa description
data (required) Data to be embedded inside the QR code. The data can be string or array depending on the type
background (optional) RGB color e.g. rgb(255,255,255)
foreground (optional) RGB color e.g. rgb(0,0,0)
logo (optional) Path to the logo either png or jpg
curl --location --request PUT 'https://uto.la/api/qr/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/qr/:id/update",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    CURLOPT_POSTFIELDS => '{
    "type": "link",
    "data": "https:\/\/google.com",
    "background": "rgb(255,255,255)",
    "foreground": "rgb(0,0,0)",
    "logo": "https:\/\/site.com\/logo.png"
}',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "QR has been updated successfully."
}
Supprimer un code QR
DELETE https://uto.la/api/qr/:id/delete

Pour supprimer un code QR, vous devez envoyer une demande DELETE.

curl --location --request DELETE 'https://uto.la/api/qr/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/qr/:id/delete",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "QR Code has been deleted successfully."
}

Des plans

Ce point de terminaison n'est accessible que par les utilisateurs disposant de privilèges d'administrateur.

Lister tous les forfaits
GET https://uto.la/api/plans

Obtenez une liste de tous les plans sur la plate-forme.

curl --location --request GET 'https://uto.la/api/plans' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/plans",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "data": [
        {
            "id": 2,
            "name": "Business",
            "free": false,
            "prices": {
                "monthly": 9.99,
                "yearly": 99.99,
                "lifetime": 999.99
            },
            "limits": {
                "links": 100,
                "clicks": 100000,
                "retention": 60,
                "custom": {
                    "enabled": "0"
                },
                "team": {
                    "enabled": "0",
                    "count": "0"
                },
                "splash": {
                    "enabled": "1",
                    "count": "5"
                },
                "overlay": {
                    "enabled": "1",
                    "count": "10"
                },
                "pixels": {
                    "enabled": "1",
                    "count": "10"
                },
                "domain": {
                    "enabled": "1",
                    "count": "1"
                },
                "multiple": {
                    "enabled": "0"
                },
                "alias": {
                    "enabled": "1"
                },
                "device": {
                    "enabled": "0"
                },
                "geo": {
                    "enabled": "0"
                },
                "bundle": {
                    "enabled": "0"
                },
                "parameters": {
                    "enabled": "0"
                },
                "export": {
                    "enabled": "0"
                },
                "api": {
                    "enabled": "0"
                }
            }
        },
        {
            "id": 1,
            "name": "Starter",
            "free": true,
            "prices": null,
            "limits": {
                "links": 10,
                "clicks": 1000,
                "retention": 7,
                "custom": {
                    "enabled": "0"
                },
                "team": {
                    "enabled": "0",
                    "count": "0"
                },
                "splash": {
                    "enabled": "0",
                    "count": "0"
                },
                "overlay": {
                    "enabled": "0",
                    "count": "10"
                },
                "pixels": {
                    "enabled": "0",
                    "count": "10"
                },
                "domain": {
                    "enabled": "0",
                    "count": "0"
                },
                "multiple": {
                    "enabled": "0"
                },
                "alias": {
                    "enabled": "0"
                },
                "device": {
                    "enabled": "0"
                },
                "geo": {
                    "enabled": "0"
                },
                "bundle": {
                    "enabled": "0"
                },
                "parameters": {
                    "enabled": "0"
                },
                "export": {
                    "enabled": "0"
                },
                "api": {
                    "enabled": "0"
                }
            }
        }
    ]
}
Abonnez un utilisateur à un forfait
PUT https://uto.la/api/plan/:planid/user/:userid

Pour abonner un utilisateur au plan, envoyez une demande PUT à ce point de terminaison avec l'ID du plan et l'ID utilisateur. Le type d'abonnement et la date d'expiration devront être précisés. Si la date de péremption n'est pas précisée, la date sera ajustée en fonction du type.

ParamètreLa description
type monthly | yearly | lifetime
expiration (facultatif) Date d'expiration du plan, par ex.2024-04-29 06:00:37
curl --location --request PUT 'https://uto.la/api/plan/:planid/user/:userid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "monthly",
    "expiration": "2024-04-29 06:00:37"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/plan/:planid/user/:userid",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    CURLOPT_POSTFIELDS => '{
    "type": "monthly",
    "expiration": "2024-04-29 06:00:37"
}',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "User has been subscribed to this plan."
}

Utilisateurs

Ce point de terminaison n'est accessible que par les utilisateurs disposant de privilèges d'administrateur.

Lister tous les utilisateurs
GET https://uto.la/api/users?filter=free

Obtenez une liste de tous les utilisateurs de la plate-forme. Les données peuvent être filtrées en envoyant un paramètre de filtre dans l'url.

ParamètreLa description
filter admin | free | pro
curl --location --request GET 'https://uto.la/api/users?filter=free' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/users?filter=free",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "data": [
        {
            "id": 2,
            "email": "sample2@domain.com",
            "username": "sample2user",
            "avatar": "https:\\\/\\\/domain.com\/content\/avatar2.png",
            "status": "free",
            "planid": 1,
            "expires": null,
            "registered": "2020-11-10 18:01:43"
        },
        {
            "id": 1,
            "email": "sample@domain.com",
            "username": "sampleuser",
            "avatar": "https:\\\/\\\/domain.com\/content\/avatar.png",
            "status": "pro",
            "planid": 2,
            "expires": "2022-11-15 15:00:00",
            "registered": "2020-11-10 18:01:43"
        }
    ]
}
Créer un utilisateur
POST https://uto.la/api/user/add

Pour créer un utilisateur, utilisez ce point de terminaison et envoyez les informations suivantes au format JSON.

ParamètreLa description
username (required) User's username. Needs to be valid.
email (required) User's email. Needs to be valid.
password (required) User's password. Minimum 5 characters.
planid (optional) Premium plan. This can be found in the admin panel.
expiration (optional) Membership expiration example 2020-12-26 12:00:00
curl --location --request POST 'https://uto.la/api/user/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "username": "user",
    "password": "1234567891011",
    "email": "demo@yourwebsite.com",
    "planid": 1,
    "expiration": "2020-11-20 11:00:00"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/user/add",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    CURLOPT_POSTFIELDS => '{
    "username": "user",
    "password": "1234567891011",
    "email": "demo@yourwebsite.com",
    "planid": 1,
    "expiration": "2020-11-20 11:00:00"
}',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "User has been registered.",
    "data": {
        "id": 3,
        "email": "demo@yourwebsite.com",
        "username": "user"
    }
}
Supprimer un utilisateur
DELETE https://uto.la/api/user/:id/delete

Pour supprimer un utilisateur, utilisez ce point de terminaison.

curl --location --request DELETE 'https://uto.la/api/user/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://uto.la/api/user/:id/delete",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse du serveur
{
    "error": 0,
    "message": "User has been deleted."
}