Documentação da API Alojamento web acessível a todos Visitar a LWS

Compra de um alojamento/domínio

Diferido Ação paga

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

operationIdpostHostingBuy

Compra um domínio ou um alojamento na sua conta. 'package' é o nome do alojamento a comprar (escolha 'domaine' para comprar apenas o domínio).

Este pedido é processado em segundo plano: responde de imediato enquanto o trabalho continua. Acompanhe-o com os endpoints de tarefas ou pedidos.

Esta ação é paga. A sua conta pré-paga será debitada.

Corpo do pedido

  • package string

    Que alojamento comprar entre todos os alojamentos LWS

    Exemplo: LWS Perso

    opcional
  • domain string

    Nome de domínio ao qual associar o alojamento

    Exemplo: example.com

    opcional
  • owner integer

    Proprietário do alojamento

    Exemplo: 565487

    opcional
  • type string

    Todas as opções compram o alojamento selecionado. 'buy' também compra o domínio; 'host' compra apenas o alojamento, assumindo que já possui o domínio; 'transfer' transfere um domínio existente de outro registrador para a LWS.

    Exemplo: buy

    opcional
  • period integer

    Duração do alojamento

    Exemplo: 12

    opcional
Exemplo de pedido
{
  "package": "LWS Perso",
  "domain": "example.com",
  "owner": 565487,
  "type": "buy",
  "period": 12
}

Respostas

200

Alojamento criado com sucesso

{
  "code": 200,
  "info": "Your domain example.com has been bought with the hosting LWS Perso.",
  "data": []
}
Campos da resposta 3
  • code integer

    Exemplo: 200

  • info string

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

  • data object
400

Entrada inválida

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

    Exemplo: 400

  • info object

    Exemplo: {"domain":"Required field"}

  • data object

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

401

Não autorizado - Faltam os cabeçalhos de autenticação

{
  "code": 401,
  "info": "Unauthorized access to the API. Please specify X-Auth-Pass and X-Auth-Login to proceed."
}
Campos da resposta 2
  • code integer

    Exemplo: 401

  • info string

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

429

Limite de pedidos excedido

{
  "code": 429,
  "info": "Rate limit exceeded. Please try again later."
}
Campos da resposta 2
  • code integer

    Exemplo: 429

  • info string

    Exemplo: Rate limit exceeded. Please try again later.

500

Erro interno do servidor

{
  "code": 500,
  "info": "Internal Server Error",
  "data": "Error message"
}
Campos da resposta 3
  • code integer

    Exemplo: 500

  • info string

    Exemplo: Internal Server Error

  • data string

    Exemplo: Error message

502

Gateway inválido

{
  "code": 502,
  "info": "Invalid response from upstream server",
  "data": []
}
Campos da resposta 3
  • code integer

    Exemplo: 502

  • info string

    Exemplo: Invalid response from upstream server

  • data object
Mostrar os exemplos de código e a consola de testes
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)