Introduction
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
This API is not authenticated.
Commandes
Stocke une nouvelle commande avec ses personnalisations et paiement.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/commandes" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"elementColors\": \"consequatur\",
\"colorChange\": \"consequatur\",
\"logo\": false,
\"remarque\": \"consequatur\",
\"total\": 11613.31890586,
\"product\": \"consequatur\",
\"quantity\": 17,
\"eyeletColor\": \"consequatur\",
\"notchedDial\": \"consequatur\",
\"pvcCase\": \"consequatur\",
\"reverseSide\": \"consequatur\"
}"
const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/commandes"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"elementColors": "consequatur",
"colorChange": "consequatur",
"logo": false,
"remarque": "consequatur",
"total": 11613.31890586,
"product": "consequatur",
"quantity": 17,
"eyeletColor": "consequatur",
"notchedDial": "consequatur",
"pvcCase": "consequatur",
"reverseSide": "consequatur"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201):
{
"message": "Commande traitée avec succès",
"commande_id": 123,
"commande": {
"N_COMMANDE": 123,
"N_COMPTE": "456",
...
}
}
Example response (401):
{
"error": "Utilisateur non authentifié"
}
Example response (500):
{
"error": "Erreur lors de la création de la commande",
"message": "Détails de l'erreur"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Contact
Envoie un email via le formulaire de contact.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/contact" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"consequatur\",
\"email\": \"qkunze@example.com\",
\"subject\": \"consequatur\",
\"message\": \"consequatur\"
}"
const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/contact"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "consequatur",
"email": "qkunze@example.com",
"subject": "consequatur",
"message": "consequatur"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200):
{
"message": "Email envoyé avec succès"
}
Example response (422):
{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email must be a valid email address."
],
"name": [
"The name field is required."
]
}
}
Example response (500):
{
"error": "Erreur lors de l'envoi de l'email",
"message": "Détails de l'erreur"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Endpoints
Authentification de l'utilisateur via API.
Valide les données reçues, vérifie les identifiants, génère un token d'authentification et renvoie les informations client avec le token.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"qkunze@example.com\",
\"password\": \"Z5ij-e\\/dl4m{o,\"
}"
const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "qkunze@example.com",
"password": "Z5ij-e\/dl4m{o,"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Enregistre une nouvelle inscription client avec validation des données, création en base, et envoi de mail de vérification.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/inscription" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"type_client\": \"consequatur\",
\"nom_client\": \"consequatur\",
\"prenom_client\": \"consequatur\",
\"email\": \"qkunze@example.com\",
\"tele\": \"consequatur\",
\"motpasse_client\": \"consequatur\",
\"ville\": \"consequatur\",
\"code_postal\": \"consequatur\",
\"pays\": \"consequatur\",
\"nom_rue\": \"consequatur\",
\"motpasse_client_confirmation\": \"consequatur\",
\"numero_rue\": \"consequatur\",
\"complement\": \"consequatur\",
\"sex\": \"consequatur\",
\"societe\": \"consequatur\",
\"n_tva\": \"consequatur\",
\"service\": \"consequatur\",
\"site_web\": \"consequatur\"
}"
const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/inscription"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"type_client": "consequatur",
"nom_client": "consequatur",
"prenom_client": "consequatur",
"email": "qkunze@example.com",
"tele": "consequatur",
"motpasse_client": "consequatur",
"ville": "consequatur",
"code_postal": "consequatur",
"pays": "consequatur",
"nom_rue": "consequatur",
"motpasse_client_confirmation": "consequatur",
"numero_rue": "consequatur",
"complement": "consequatur",
"sex": "consequatur",
"societe": "consequatur",
"n_tva": "consequatur",
"service": "consequatur",
"site_web": "consequatur"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201):
{
"status": "success",
"message": "Inscription réussie. Un email de vérification a été envoyé à email@example.com",
"client": {
"id": 123,
"email": "email@example.com",
"name": "Prénom Nom"
}
}
Example response (422):
{
"status": "error",
"errors": {
"email": [
"Cet email est déjà utilisé."
],
"motpasse_client": [
"La confirmation du mot de passe ne correspond pas."
]
}
}
Example response (500):
{
"status": "error",
"message": "Erreur lors de l'inscription",
"error": "Détails de l'erreur"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Envoi d'un email de vérification à un client.
Cette méthode valide l'email fourni dans la requête, vérifie que
l'email existe bien dans la table client. Si le client n'a pas encore
de token de vérification, elle en génère un nouveau.
Ensuite, elle envoie un email de vérification à cette adresse.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/send-verification-email" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"qkunze@example.com\"
}"
const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/send-verification-email"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "qkunze@example.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Vérifie le token de validation d'email et active le compte utilisateur.
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/verify-email/consequatur" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/verify-email/consequatur"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"status": "success",
"message": "Email vérifié avec succès !",
"client": {
"n_compte": 123,
"email": "email@example.com",
"email_verified_at": "2025-05-17T14:00:00Z"
}
}
Example response (200):
{
"status": "info",
"message": "Votre email a déjà été vérifié"
}
Example response (404):
{
"status": "error",
"message": "Lien de vérification invalide ou expiré"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/client
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/client" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/client"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (302):
Show headers
cache-control: no-cache, private
location: https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login
content-type: text/html; charset=utf-8
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login'" />
<title>Redirecting to https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</title>
</head>
<body>
Redirecting to <a href="https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login">https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/user
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/user" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/user"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (302):
Show headers
cache-control: no-cache, private
location: https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login
content-type: text/html; charset=utf-8
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login'" />
<title>Redirecting to https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</title>
</head>
<body>
Redirecting to <a href="https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login">https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Déconnexion de l'utilisateur.
Révoque tous les tokens d'authentification pour l'utilisateur connecté.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/logout" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/logout"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Créer une nouvelle personnalisation à partir des données reçues en POST.
Cette méthode reçoit les paramètres de personnalisation d'une commande, initialise les valeurs par défaut, met à jour les valeurs selon les entrées, puis crée un enregistrement en base de données.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/personnalisations" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/personnalisations"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Crée un paiement avec PayPlug et enregistre les informations dans la base.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/debug/auth-test
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/debug/auth-test" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/debug/auth-test"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (302):
Show headers
cache-control: no-cache, private
location: https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login
content-type: text/html; charset=utf-8
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login'" />
<title>Redirecting to https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</title>
</head>
<body>
Redirecting to <a href="https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login">https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET api/debug/auth-verify
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/debug/auth-verify" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/debug/auth-verify"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (302):
Show headers
cache-control: no-cache, private
location: https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login
content-type: text/html; charset=utf-8
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login'" />
<title>Redirecting to https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</title>
</head>
<body>
Redirecting to <a href="https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login">https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Traitement des notifications webhook envoyées par PayPlug.
Met à jour le statut du paiement en fonction de la notification reçue.
Example request:
curl --request POST \
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/webhook" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/webhook"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Gère la redirection après paiement réussi.
Met à jour le statut du paiement et de la commande dans la base.
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/success/consequatur" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/success/consequatur"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
Show headers
content-type: text/html; charset=UTF-8
cache-control: no-cache, private
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<title>Paiement réussi</title>
<meta http-equiv="refresh" content="3;url=http://localhost:3000/" />
</head>
<body style="text-align: center; padding: 50px; font-family: Arial;">
<h1>Paiement réussi !</h1>
<p>Vous allez être redirigé vers la page d'accueil dans quelques instants...</p>
<p>Si ce n'est pas le cas, <a href="http://localhost:3000/">cliquez ici</a>.</p>
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Gère la redirection après annulation du paiement.
Met à jour le statut du paiement en échec.
Example request:
curl --request GET \
--get "https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/cancel/consequatur" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://fcf3-2a02-8429-19c2-4501-2061-9805-e176-254.ngrok-free.app/api/payment/cancel/consequatur"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
Show headers
content-type: text/html; charset=UTF-8
cache-control: no-cache, private
vary: Origin
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
<!DOCTYPE html>
<html>
<head>
<title>Paiement annulé</title>
<meta http-equiv="refresh" content="3;url=http://localhost:3000/order?error=payment_cancelled" />
</head>
<body style="text-align: center; padding: 50px; font-family: Arial;">
<h1>❌ Paiement annulé</h1>
<p>Vous allez être redirigé vers votre commande dans quelques instants...</p>
<p>Si ce n'est pas le cas, <a href="http://localhost:3000/order?error=payment_cancelled">cliquez ici</a>.</p>
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.