X.gd Developers
Fornecemos uma API para encurtar URLs de aplicativos externos. Uma chave API é necessária para usar a API.
API de encurtamento de URL
Shorten API v1.0
GET https://xgd.io/V1/shorten
Solicitação
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | url | String | http(s):// | URL a encurtar | https://example.com |
| shortid | String | [0-9a-zA-Z_]{6,15} | URL curta personalizada. Atribuição aleatória se omitida | example | |
| analytics | String | true / false | Ativar análise de acesso. Ativado se omitido | true | |
| filterbots | String | true / false | Filtragem de bots quando a análise está ativada. Desativado se omitido | false | |
| * | key | String | [0-9a-f]{32} | Chave API emitida | 0af50e06255c7004f9ad71338f5ad56e |
Exemplo de solicitação (URL)
https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}Exemplo de solicitação (cURL)
curl -X GET 'https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}'Resposta (Sucesso)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 200 | Código de status | 200 |
| * | shorturl | String | https://x.gd/[0-9a-zA-Z_]+ | URL encurtada | https://x.gd/example |
| * | analytics | Boolean | true / false | Análise de acesso | true |
| * | filterbots | Boolean | true / false | Filtragem de bots | false |
| * | originalurl | String | http(s):// | URL original | https://example.com |
Exemplo de resposta
status: 200
content-type: application/json
{
"status": 200,
"shorturl": "https://x.gd/example",
"analytics": true,
"filterbots": false,
"originalurl": "https://example.com/"
}Resposta (Falha)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 400 / 401 / 403 / 409 / 429 / 500 / 503 | Código de status | 429 |
| * | message | String | - | Mensagem de erro | Too many requests. |
Exemplo de resposta
status: 200
content-type: application/json
{
"status": 429,
"message": "Too many requests."
}Código de status
| Status | Description |
|---|---|
| 200 | A resposta é normal. |
| 400 | Ocorreu um erro na solicitação. A mensagem contém detalhes. |
| 401 | O token não é válido. Verifique sua chave API. |
| 403 | Temporariamente ou permanentemente indisponível. |
| 409 | Impossível emitir URL encurtada nas condições solicitadas. A mensagem contém detalhes. |
| 429 | Limite de uso da API atingido. Aguarde até que o limite seja levantado e tente novamente. |
| 500 | Ocorreu um erro de sistema temporário. Tente novamente após algum tempo. |
| 503 | O serviço está temporariamente indisponível. Tente novamente após algum tempo. |
Chave API
Enviaremos uma URL para emitir uma chave API para o endereço de e-mail que você forneceu.
Você deve concluir o procedimento dentro de 24 horas após o envio.