X.gd Developers
Forniamo un'API per abbreviare gli URL da applicazioni esterne. È richiesta una chiave API per utilizzare l'API.
API di abbreviazione URL
Shorten API v1.0
GET https://xgd.io/V1/shorten
Richiesta
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | url | String | http(s):// | URL da abbreviare | https://example.com |
| shortid | String | [0-9a-zA-Z_]{6,15} | URL breve personalizzato. Assegnazione casuale se omesso | example | |
| analytics | String | true / false | Abilita analisi degli accessi. Abilitato se omesso | true | |
| filterbots | String | true / false | Filtraggio bot quando l'analisi è abilitata. Disabilitato se omesso | false | |
| * | key | String | [0-9a-f]{32} | Chiave API emessa | 0af50e06255c7004f9ad71338f5ad56e |
Esempio di richiesta (URL)
https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}Esempio di richiesta (cURL)
curl -X GET 'https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}'Risposta (Successo)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 200 | Codice di stato | 200 |
| * | shorturl | String | https://x.gd/[0-9a-zA-Z_]+ | URL abbreviato | https://x.gd/example |
| * | analytics | Boolean | true / false | Analisi degli accessi | true |
| * | filterbots | Boolean | true / false | Filtraggio bot | false |
| * | originalurl | String | http(s):// | URL originale | https://example.com |
Esempio di risposta
status: 200
content-type: application/json
{
"status": 200,
"shorturl": "https://x.gd/example",
"analytics": true,
"filterbots": false,
"originalurl": "https://example.com/"
}Risposta (Fallimento)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 400 / 401 / 403 / 409 / 429 / 500 / 503 | Codice di stato | 429 |
| * | message | String | - | Messaggio di errore | Too many requests. |
Esempio di risposta
status: 200
content-type: application/json
{
"status": 429,
"message": "Too many requests."
}Codice di stato
| Status | Description |
|---|---|
| 200 | La risposta è normale. |
| 400 | Si è verificato un errore nella richiesta. Il messaggio contiene i dettagli. |
| 401 | Il token non è valido. Verifica la tua chiave API. |
| 403 | Temporaneamente o permanentemente non disponibile. |
| 409 | Impossibile emettere URL abbreviato nelle condizioni richieste. Il messaggio contiene i dettagli. |
| 429 | Limite di utilizzo API raggiunto. Attendi fino al rilascio del limite e riprova. |
| 500 | Si è verificato un errore di sistema temporaneo. Riprova dopo un po' di tempo. |
| 503 | Il servizio è temporaneamente non disponibile. Riprova dopo un po' di tempo. |
Chiave API
Invieremo un URL per emettere una chiave API all'indirizzo email che hai fornito.
Devi completare la procedura entro 24 ore dall'invio.