Documentación de la API El alojamiento web accesible para todos Visitar LWS

Añadir crédito a un contacto dado (solo en el Entorno de pruebas)

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

operationIdputContactCredit

No implementado fuera del Entorno de pruebas. Envíe la cabecera X-Test-Mode para acceder a la implementación funcional de esta operación; sin ella, este endpoint siempre devuelve 501.

Parámetros de ruta

contact integer obligatorio

ID LWS del contacto al que añadir crédito

Cuerpo de la solicitud

  • amount integer

    Importe del crédito a añadir

    opcional
Ejemplo de solicitud
{
  "amount": 0
}

Respuestas

401

No autorizado - Faltan las cabeceras de autenticación

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

    Ejemplo: 401

  • info string

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

429

Límite de solicitudes excedido

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

    Ejemplo: 429

  • info string

    Ejemplo: Rate limit exceeded. Please try again later.

501

No implementado fuera del Entorno de pruebas

Se devuelve fuera del entorno de pruebas. Esta operación solo funciona con X-Test-Mode activado.

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

    Ejemplo: 405

  • info string

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

Mostrar los ejemplos de código y la consola de pruebas
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)