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

Ajouter du crédit à un contact donné (Environnement de test uniquement)

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

operationIdputContactCredit

Non implémenté en dehors de l'Environnement de test. Envoyez l'en-tête X-Test-Mode pour atteindre l'implémentation fonctionnelle de cette opération ; sans cela, ce endpoint retourne toujours 501.

Paramètres du chemin

contact integer requis

ID LWS du contact auquel ajouter du crédit

Corps de la requête

  • amount integer

    Montant du crédit à ajouter

    facultatif
Exemple de requête
{
  "amount": 0
}

Réponses

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.

501

Non implémenté en dehors de l'Environnement de test

Renvoyé hors de l’environnement de test. Cette opération ne fonctionne qu’avec X-Test-Mode activé.

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

    Exemple: 405

  • info string

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

Afficher les exemples de code et la console de test
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)