Documentazione dell'API
La nostra API segue il formato standard del mercato: ogni chiamata è una richiesta POST verso un indirizzo unico, con la Sua chiave (key) e un'azione (action). Gli script dei rivenditori esistenti sono quindi compatibili senza modifiche. Crei la Sua chiave dalla Sua area, sezione «API».
Indirizzo: https://sociallikeyou.com/api/v2
Metodo: POST · Risposta: JSON
Liste des services
| Parametro | Descrizione |
|---|---|
key | La Sua chiave API |
action | services |
Esempio di risposta
[{"service":1,"name":"…","type":"Default","category":"…","rate":"0.9","min":"10","max":"10000","refill":false,"cancel":false}]
Passer une commande
| Parametro | Descrizione |
|---|---|
key | La Sua chiave API |
action | add |
service | ID du service |
link | Lien |
quantity | Quantité |
idempotency_key | Facultatif : identifiant unique pour éviter les doublons en cas de nouvel essai |
Esempio di risposta
{"order":23501}
Statut d’une commande
| Parametro | Descrizione |
|---|---|
key | La Sua chiave API |
action | status |
order | ID de la commande |
Esempio di risposta
{"charge":"0.27819","start_count":"3572","status":"Partial","remains":"157","currency":"EUR"}
Statut de plusieurs commandes (100 max)
| Parametro | Descrizione |
|---|---|
key | La Sua chiave API |
action | status |
orders | IDs séparés par des virgules |
Esempio di risposta
{"1":{"charge":"0.27","start_count":"0","status":"Completed","remains":"0","currency":"EUR"},"10":{"error":"Incorrect order ID"}}
Solde du compte
| Parametro | Descrizione |
|---|---|
key | La Sua chiave API |
action | balance |
Esempio di risposta
{"balance":"100.84","currency":"EUR"}
API REST (JSON) e notifiche
Per i nuovi sviluppi è disponibile un'API REST all'indirizzo https://sociallikeyou.com/api/rest/v1 con l'intestazione Authorization: Bearer LA_SUA_CHIAVE : GET /services, GET /balance, GET /orders, GET /orders/{id} e POST /orders. La creazione richiede l'intestazione Idempotency-Key, così un nuovo tentativo dopo un'interruzione non crea mai un duplicato. Specifica completa in formato OpenAPI: openapi.json.
Notifiche: indichi un indirizzo HTTPS nella Sua area (sezione API). A ogni cambio di stato inviamo un POST JSON con l'intestazione X-Webhook-Signature: t=…,v1=…. Per verificarlo, calcoli l'HMAC-SHA256 di t.corps con il Suo secret. In caso di errore, l'invio viene ritentato fino a 10 volte, nell'arco di circa 24 ore.
Errori
Gli errori applicativi restituiscono {"error": "message"}. Chiave non valida: HTTP 401. Troppe richieste: HTTP 429 (limite predefinito: 120 richieste al minuto per chiave).
Esempi
PHP
<?php
$ch = curl_init("https://sociallikeyou.com/api/v2");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query([
"key" => "VOTRE_CLE", "action" => "add",
"service" => 1, "link" => "https://exemple.com/page", "quantity" => 1000,
]),
]);
$reponse = json_decode(curl_exec($ch), true);
Python
import requests
r = requests.post("https://sociallikeyou.com/api/v2", data={"key": "VOTRE_CLE", "action": "balance"}, timeout=30)
print(r.json())
JavaScript (Node.js)
const r = await fetch("https://sociallikeyou.com/api/v2", {
method: "POST",
body: new URLSearchParams({ key: "VOTRE_CLE", action: "services" }),
});
console.log(await r.json());