Endpoint
GET /api/v1/feeds/{platform}
| Parâmetro | Valores |
|---|---|
platform | google, meta, openai |
Requisição Básica
curl "https://app.alana.shopping/api/v1/feeds/google" \
-H "X-API-Key: sk_live_sua_chave_api"
const res = await fetch(
"https://app.alana.shopping/api/v1/feeds/google",
{ headers: { "X-API-Key": "sk_live_sua_chave_api" } }
);
const xml = await res.text();
import requests
res = requests.get(
"https://app.alana.shopping/api/v1/feeds/google",
headers={"X-API-Key": "sk_live_sua_chave_api"},
)
print(res.text)
Streaming NDJSON
Para catálogos grandes, use NDJSON para processar produtos um de cada vez:curl "https://app.alana.shopping/api/v1/feeds/google" \
-H "X-API-Key: sk_live_sua_chave_api" \
-H "Accept: application/x-ndjson"
const res = await fetch(
"https://app.alana.shopping/api/v1/feeds/google",
{
headers: {
"X-API-Key": "sk_live_sua_chave_api",
Accept: "application/x-ndjson",
},
}
);
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const lines = decoder.decode(value).split("\n").filter(Boolean);
for (const line of lines) {
const product = JSON.parse(line);
console.log(product.id, product.title);
}
}
import requests, json
with requests.get(
"https://app.alana.shopping/api/v1/feeds/google",
headers={
"X-API-Key": "sk_live_sua_chave_api",
"Accept": "application/x-ndjson",
},
stream=True,
) as res:
for line in res.iter_lines():
if line:
product = json.loads(line)
print(product["id"], product["title"])
ETag e Feeds Delta
UseETag para polling eficiente — baixe um novo feed apenas quando o conteúdo mudar:
# Primeira requisição — salve o ETag
curl -I "https://app.alana.shopping/api/v1/feeds/google" \
-H "X-API-Key: sk_live_sua_chave_api"
# ETag: "abc123def456"
# Requisições subsequentes — pule o download se não mudou
curl "https://app.alana.shopping/api/v1/feeds/google" \
-H "X-API-Key: sk_live_sua_chave_api" \
-H "If-None-Match: \"abc123def456\""
# Retorna 304 Not Modified se o feed não mudou
let etag = null;
async function pollFeed() {
const headers = { "X-API-Key": "sk_live_sua_chave_api" };
if (etag) headers["If-None-Match"] = etag;
const res = await fetch(
"https://app.alana.shopping/api/v1/feeds/google",
{ headers }
);
if (res.status === 304) return null;
etag = res.headers.get("ETag");
return await res.text();
}
import requests
etag = None
def poll_feed():
global etag
headers = {"X-API-Key": "sk_live_sua_chave_api"}
if etag:
headers["If-None-Match"] = etag
res = requests.get(
"https://app.alana.shopping/api/v1/feeds/google",
headers=headers,
)
if res.status_code == 304:
return None
etag = res.headers.get("ETag")
return res.text
Headers de Resposta
| Header | Descrição |
|---|---|
ETag | Hash do conteúdo para requisições condicionais |
Last-Modified | Timestamp da última geração do feed |
X-Feed-Product-Count | Número de produtos no feed |
Cache-Control | max-age=900 (cache de 15 minutos) |
Parâmetros de Query
| Parâmetro | Tipo | Descrição |
|---|---|---|
catalog_id | string | Filtrar para um catálogo específico (opcional) |
limit | integer | Máximo de produtos por página |
offset | integer | Offset de paginação |