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

Obter todos os contactos geridos pelo utilizador

GET https://api.lws.net/v1/contact/0/list

operationIdget0List

Obtém um array associativo [ID => {dados}] de todos os contactos geridos pelo utilizador.

Respostas

200

Lista de contactos obtida com sucesso

{
  "code": 200,
  "info": "Customer list fetched",
  "data": [
    [
      {
        "company": "Minha Empresa",
        "lastname": "Silva",
        "firstname": "João",
        "address": "1 rue de la Paix",
        "postal": "75000",
        "city": "Paris",
        "country": "França",
        "phone": "0033612345678",
        "email": "[email protected]",
        "is_company": true,
        "credit": 0
      }
    ]
  ]
}
Campos da resposta 3
  • code integer

    Exemplo: 200

  • info string

    Exemplo: Customer list fetched

  • data object[][]

    Array associativo $key=>$value em que $key é o ID e $value as informações do contacto

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.

404

Nenhum contacto encontrado. Pode dever-se a um erro ou a não existirem contactos geridos pelo utilizador

{
  "code": 404,
  "info": "No contacts could be fetched",
  "data": []
}
Campos da resposta 3
  • code integer

    Exemplo: 404

  • info string

    Exemplo: No contacts could be fetched

  • data any[]
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": "Details on the error"
}
Campos da resposta 3
  • code integer

    Exemplo: 500

  • info string

    Exemplo: Internal Server Error

  • data string

    Exemplo: Details on the error

502

Foi devolvida uma resposta inválida. Significa geralmente que os dados devolvidos não eram os esperados.

{
  "code": 502,
  "info": "Invalid response from upstream server",
  "data": {
    "status": 500,
    "error": "Internal Server Error"
  }
}
Campos da resposta 3
  • code integer

    Exemplo: 502

  • info string

    Exemplo: Invalid response from upstream server

  • data any[]

    Exemplo: {"status":500,"error":"Internal Server Error"}

Mostrar os exemplos de código e a consola de testes
GET /contact/0/list
LWS_AUTH_LOGIN='…'LWS_AUTH_PASS='…'curl -X GET \  "https://api.lws.net/v1/contact/0/list" \  -H "X-Auth-Login: $LWS_AUTH_LOGIN" \  -H "X-Auth-Pass: $LWS_AUTH_PASS"
$lwsAuthLogin = '…';$lwsAuthPass = '…';$ch = curl_init("https://api.lws.net/v1/contact/0/list");curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [    "X-Auth-Login: " . $lwsAuthLogin,    "X-Auth-Pass: " . $lwsAuthPass,]);$res = json_decode(curl_exec($ch), true);
import requestsLWS_AUTH_LOGIN = "…"LWS_AUTH_PASS = "…"res = requests.get(    "https://api.lws.net/v1/contact/0/list",    headers={        "X-Auth-Login": LWS_AUTH_LOGIN,        "X-Auth-Pass": LWS_AUTH_PASS,    },)print(res.json())
const LWS_AUTH_LOGIN = "…";const LWS_AUTH_PASS = "…";const res = await fetch("https://api.lws.net/v1/contact/0/list", {  method: "GET",  headers: {    "X-Auth-Login": LWS_AUTH_LOGIN,    "X-Auth-Pass": LWS_AUTH_PASS,  },});const data = await res.json();
lwsAuthLogin := "…"lwsAuthPass := "…"req, _ := http.NewRequest("GET",    "https://api.lws.net/v1/contact/0/list", nil)req.Header.Set("X-Auth-Login", lwsAuthLogin)req.Header.Set("X-Auth-Pass", lwsAuthPass)resp, err := http.DefaultClient.Do(req)