Documentation API L’hébergement web accessible à tous Visiter LWS

Achat d'un hébergement/domaine

Différé Action payante

POST https://api.lws.net/v1/hosting

operationIdpostHostingBuy

Achète un domaine ou un hébergement sur votre compte. 'package' est le nom de l'hébergement à acheter (choisissez 'domaine' pour n'acheter que le domaine).

Cette requête est traitée en arrière-plan : elle répond immédiatement pendant que le travail se poursuit. Suivez-la avec les opérations de tâches ou de requêtes.

Cette action est payante. Votre compte prépayé sera débité.

Corps de la requête

  • package string

    Quel hébergement acheter parmi tous les hébergements LWS

    Exemple: LWS Perso

    facultatif
  • domain string

    Nom de domaine auquel associer l'hébergement

    Exemple: example.com

    facultatif
  • owner integer

    Propriétaire de l'hébergement

    Exemple: 565487

    facultatif
  • type string

    Toutes les options achètent l'hébergement sélectionné. 'buy' achète également le domaine ; 'host' achète uniquement l'hébergement, en supposant que vous possédez déjà le domaine ; 'transfer' transfère un domaine existant depuis un autre registrar vers LWS.

    Exemple: buy

    facultatif
  • period integer

    Durée de l'hébergement

    Exemple: 12

    facultatif
Exemple de requête
{
  "package": "LWS Perso",
  "domain": "example.com",
  "owner": 565487,
  "type": "buy",
  "period": 12
}

Réponses

200

Hébergement créé avec succès

{
  "code": 200,
  "info": "Your domain example.com has been bought with the hosting LWS Perso.",
  "data": []
}
Champs de la réponse 3
  • code integer

    Exemple: 200

  • info string

    Exemple: Your domain example.com has been bought with the hosting LWS Perso.

  • data object
400

Entrée invalide

{
  "code": 400,
  "info": {
    "domain": "Required field"
  },
  "data": {
    "domain": "/^(?!-)([A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,15}$/"
  }
}
Champs de la réponse 3
  • code integer

    Exemple: 400

  • info object

    Exemple: {"domain":"Required field"}

  • data object

    Exemple: {"domain":"/^(?!-)([A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,15}$/"}

401

Non autorisé - En-têtes d'authentification manquants

{
  "code": 401,
  "info": "Unauthorized access to the API. Please specify X-Auth-Pass and X-Auth-Login to proceed."
}
Champs de la réponse 2
  • code integer

    Exemple: 401

  • info string

    Exemple: Unauthorized access to the API. Please specify X-Auth-Pass and X-Auth-Login to proceed.

429

Limite de requêtes dépassée

{
  "code": 429,
  "info": "Rate limit exceeded. Please try again later."
}
Champs de la réponse 2
  • code integer

    Exemple: 429

  • info string

    Exemple: Rate limit exceeded. Please try again later.

500

Erreur interne du serveur

{
  "code": 500,
  "info": "Internal Server Error",
  "data": "Error message"
}
Champs de la réponse 3
  • code integer

    Exemple: 500

  • info string

    Exemple: Internal Server Error

  • data string

    Exemple: Error message

502

Passerelle incorrecte

{
  "code": 502,
  "info": "Invalid response from upstream server",
  "data": []
}
Champs de la réponse 3
  • code integer

    Exemple: 502

  • info string

    Exemple: Invalid response from upstream server

  • data object
Afficher les exemples de code et la console de test
POST /hosting
LWS_AUTH_LOGIN='…'LWS_AUTH_PASS='…'curl -X POST \  "https://api.lws.net/v1/hosting" \  -H "X-Auth-Login: $LWS_AUTH_LOGIN" \  -H "X-Auth-Pass: $LWS_AUTH_PASS" \  -H "Content-Type: application/json" \  -d '{"package":"LWS Perso","domain":"example.com","owner":565487,"type":"buy","period":12}'
$lwsAuthLogin = '…';$lwsAuthPass = '…';$ch = curl_init("https://api.lws.net/v1/hosting");curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [    "X-Auth-Login: " . $lwsAuthLogin,    "X-Auth-Pass: " . $lwsAuthPass,    "Content-Type: application/json",]);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"package":"LWS Perso","domain":"example.com","owner":565487,"type":"buy","period":12}');$res = json_decode(curl_exec($ch), true);
import requestsLWS_AUTH_LOGIN = "…"LWS_AUTH_PASS = "…"res = requests.post(    "https://api.lws.net/v1/hosting",    headers={        "X-Auth-Login": LWS_AUTH_LOGIN,        "X-Auth-Pass": LWS_AUTH_PASS,    },    json={"package": "LWS Perso", "domain": "example.com", "owner": 565487, "type": "buy", "period": 12},)print(res.json())
const LWS_AUTH_LOGIN = "…";const LWS_AUTH_PASS = "…";const res = await fetch("https://api.lws.net/v1/hosting", {  method: "POST",  headers: {    "X-Auth-Login": LWS_AUTH_LOGIN,    "X-Auth-Pass": LWS_AUTH_PASS,    "Content-Type": "application/json",  },  body: JSON.stringify({"package":"LWS Perso","domain":"example.com","owner":565487,"type":"buy","period":12}),});const data = await res.json();
lwsAuthLogin := "…"lwsAuthPass := "…"body := strings.NewReader(`{"package":"LWS Perso","domain":"example.com","owner":565487,"type":"buy","period":12}`)req, _ := http.NewRequest("POST",    "https://api.lws.net/v1/hosting", body)req.Header.Set("X-Auth-Login", lwsAuthLogin)req.Header.Set("X-Auth-Pass", lwsAuthPass)req.Header.Set("Content-Type", "application/json")resp, err := http.DefaultClient.Do(req)