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

Adicionar crédito a um contacto (apenas no Ambiente de teste)

PUT https://api.lws.net/v1/contact/{contact}/credit

operationIdputContactCredit

Não implementado fora do Ambiente de teste. Envie o cabeçalho X-Test-Mode para aceder à implementação funcional desta operação; sem ele, este endpoint devolve sempre 501.

Parâmetros do caminho

contact integer obrigatório

ID LWS do contacto ao qual adicionar crédito

Corpo do pedido

  • amount integer

    Montante de crédito a adicionar

    opcional
Exemplo de pedido
{
  "amount": 0
}

Respostas

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.

501

Não implementado fora do Ambiente de teste

Devolvido fora do ambiente de teste. Esta operação só funciona com X-Test-Mode ativado.

{
  "code": 405,
  "info": "Not implemented. Make sure you are using the Test Environment for this action to work"
}
Campos da resposta 2
  • code integer

    Exemplo: 405

  • info string

    Exemplo: Not implemented. Make sure you are using the Test Environment for this action to work

Mostrar os exemplos de código e a consola de testes
PUT /contact/{contact}/credit
LWS_AUTH_LOGIN='…'LWS_AUTH_PASS='…'curl -X PUT \  "https://api.lws.net/v1/contact/{contact}/credit" \  -H "X-Auth-Login: $LWS_AUTH_LOGIN" \  -H "X-Auth-Pass: $LWS_AUTH_PASS" \  -H "Content-Type: application/json" \  -d '{"amount":0}'
$lwsAuthLogin = '…';$lwsAuthPass = '…';$ch = curl_init("https://api.lws.net/v1/contact/{contact}/credit");curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");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, '{"amount":0}');$res = json_decode(curl_exec($ch), true);
import requestsLWS_AUTH_LOGIN = "…"LWS_AUTH_PASS = "…"res = requests.put(    "https://api.lws.net/v1/contact/{contact}/credit",    headers={        "X-Auth-Login": LWS_AUTH_LOGIN,        "X-Auth-Pass": LWS_AUTH_PASS,    },    json={"amount": 0},)print(res.json())
const LWS_AUTH_LOGIN = "…";const LWS_AUTH_PASS = "…";const res = await fetch("https://api.lws.net/v1/contact/{contact}/credit", {  method: "PUT",  headers: {    "X-Auth-Login": LWS_AUTH_LOGIN,    "X-Auth-Pass": LWS_AUTH_PASS,    "Content-Type": "application/json",  },  body: JSON.stringify({"amount":0}),});const data = await res.json();
lwsAuthLogin := "…"lwsAuthPass := "…"body := strings.NewReader(`{"amount":0}`)req, _ := http.NewRequest("PUT",    "https://api.lws.net/v1/contact/{contact}/credit", 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)