API Bephoto

Consultez la documentation ci-dessous pour automatiser vos commandes d'impression.

Bephoto API Documentation

Introduction

Sending print orders is done through a REST API. Before being able to make requests to the API, you should first authenticate using the credentials received to obtain an authentication token. The token should be included in the "Authorization" header of every subsequent API request:

Authorization: Bearer <your-authentication-token>

Live API URL https://api.bephoto.be

Login

Authenticate by calling the /user/login endpoint with your credentials:

POST /user/login { "email": "<string>", "password": "<string>" }

Success Response:

{ "status": 1, "token": "<string>" }

Error Response:

{ "error": "Unauthorized" }

Paramètres envoyés à l'API

  • email: L'adresse email de l'utilisateur.
  • password: Le mot de passe de l'utilisateur.

Order Creation

Create a new order by calling /orders with optional metadata. After creating an order, you will receive a unique idorder, which should be used in subsequent calls:

POST /orders { "metadata": "<string>" }

Success Response:

{ "status": 1, "order": [{ "idorder": "<integer>", "datestart": "<timestamp>", "totalorder": "<float>", "totalcost": "<float>", "dateconfirmation": "<timestamp>", "dateprocessed": "<timestamp>", "shippingmethod": "<string>", "metadata": "<string>" }] }

Paramètres envoyés à l'API

  • metadata: Métadonnées personnalisées associées à la commande. Max. longueur : 255 caractères.

Fetching Order

Fetch information for an order by calling /orders/{IDORDER}:

GET /orders/{IDORDER}

Success Response:

{ "status": 1, "order": [{ "idorder": "<integer>", "datestart": "<timestamp>", "totalorder": "<float>", "totalcost": "<float>", "dateconfirmation": "<timestamp>", "dateprocessed": "<timestamp>", "shippingmethod": "<string>", "metadata": "<string>" }] }

Paramètres envoyés à l'API

  • idorder: L'ID unique de la commande.

Fetching Products

Get a list of available print products by calling /products:

GET /products

Success Response:

{ "status": 1, "products": [{ "idproduct": "<integer>", "product": "<string>", "dimensions": "<string>", "prices": [{ "price": "<float>", "idpaper": "<integer>" }] }] }

Paramètres envoyés à l'API

  • idproduct: L'ID unique du produit.
  • dimensions: Les dimensions du produit (en millimètres).
  • prices: Les prix associés au produit, avec l'ID du type de papier.

Adding Products

Add products to your order by sending a POST request to /orders/{IDORDER}/products:

POST /orders/{IDORDER}/products { "idproduct": "<integer>", "idpaper": "<integer>", "quantity": "<integer>", "fileurl": "<string>", "filename": "<string>", "filesize": "<integer>" }

Success Response:

{ "status": 1 }

Paramètres envoyés à l'API

  • idproduct: L'ID unique du produit à ajouter.
  • idpaper: ID du type de papier (1 pour brillant, 2 pour lustre).
  • quantity: Quantité de produit à ajouter.
  • fileurl: URL publique du fichier image à imprimer. Le fichier doit être au format JPEG et rester disponible pendant le traitement de la commande.
  • filename: Nom du fichier image à imprimer.
  • filesize: Taille du fichier en octets.

Confirming Order

Once all products are added, close the order by calling /orders/{IDORDER}/close:

POST /orders/{IDORDER}/close {}

Success Response:

{ "status": 1 }

Paramètres envoyés à l'API

  • idorder: L'ID unique de la commande.