🌐 Site:https://gtin.rscsistemas.com.br
Para utilizar a API GTIN, é necessário possuir um usuário e senha.
Se ainda não tiver, cadastre-se em:
🔗 https://gtin.rscsistemas.com.br/cadastro
- URL:
https://gtin.rscsistemas.com.br/oauth/token - Método:
POST - Headers obrigatórios:
Authorization: Basic <base64_encoded_credentials>(onde as credenciaisusername:passwordsão codificadas em base64)Accept: application/json
Observações
- O token expira em 1 hora.
- Rate limit: 20 req/min (plano Free).
curl -X POST "https://gtin.rscsistemas.com.br/oauth/token" \
-H "Authorization: Basic <base64_encoded_credentials>" \
-H "Accept: application/json"asyncfunctionobterToken(){constres=awaitfetch("https://gtin.rscsistemas.com.br/oauth/token",{method: "POST",headers: {"Authorization": "Basic <base64_encoded_credentials>",// Substitua pelo valor codificado em base64"Accept": "application/json"}});if(!res.ok){consttxt=awaitres.text();thrownewError(`Falha ao obter token (${res.status}): ${txt}`);}constdata=awaitres.json();returndata.token;// string}uses IdHTTP, System.SysUtils;
functionObterToken: string;
var
HTTP: TIdHTTP;
Resp: string;
begin
HTTP := TIdHTTP.Create(nil);
try
HTTP.Request.CustomHeaders.Values['Authorization'] := 'Basic <base64_encoded_credentials>'; // Substitua pelo valor codificado em base64
HTTP.Request.Accept := 'application/json';
Resp := HTTP.Post('https://gtin.rscsistemas.com.br/oauth/token', nil);
Result := Resp;
finally
HTTP.Free;
end;
end;- 200 OK
{ "token": "eyJhbGciOiAiQUVTMjU2IiwgInR5cCI6ICJKV1QifQ==..." }- 401 Unauthorized
{ "erro": "Não autenticado. Verifique suas credenciais." }- URL:
https://gtin.rscsistemas.com.br/api/gtin/infor/:gtin - Método:
GET - Path param:
:gtin(string) - Header:
Authorization: Bearer <SEU_TOKEN>
GTIN="7896116900029"
TOKEN="SEU_TOKEN_AQUI"
curl -X GET "https://gtin.rscsistemas.com.br/api/gtin/infor/$GTIN" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json"asyncfunctionobterInfoProduto(gtin,token){consturl=`https://gtin.rscsistemas.com.br/api/gtin/infor/${encodeURIComponent(gtin)}`;constres=awaitfetch(url,{headers: {"Authorization": `Bearer ${token}`,"Accept": "application/json"}});if(res.status===404){consterr=awaitres.json();thrownewError(err.mensagem||"Produto não encontrado");}if(!res.ok){consttxt=awaitres.text();thrownewError(`Erro ${res.status}: ${txt}`);}returnres.json();}functionObterInfoProduto(const GTIN, Token: string): string;
var
HTTP: TIdHTTP;
URL: string;
begin
HTTP := TIdHTTP.Create(nil);
try
HTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + Token;
HTTP.Request.Accept := 'application/json';
URL := Format('https://gtin.rscsistemas.com.br/api/gtin/infor/%s', [GTIN]);
Result := HTTP.Get(URL);
finally
HTTP.Free;
end;
end;- 200 OK
{
"ean": "7896116900029",
"ean_tipo": "EAN13",
"ncm": 7133399,
"nome": "FEIJAO CARIOCA KICALDO T1 1KG",
"marca": "KICALDO",
"pais": "BRASIL",
"categoria": "Carioca",
"link_foto": "https://gtin.rscsistemas.com.br/api/gtin/img/7896116900029"
}- 404 Not Found
{ "mensagem": "Produto não encontrado na base de dados" }- URL:
https://gtin.rscsistemas.com.br/api/gtin/img/:gtin - Método:
GET - Path param:
:gtin(string) - Header:
Authorization: Bearer <SEU_TOKEN>
GTIN="7896116900029"
TOKEN="SEU_TOKEN_AQUI"
curl -L "https://gtin.rscsistemas.com.br/api/gtin/img/$GTIN" \
-H "Authorization: Bearer $TOKEN" \
--output "${GTIN}.png"asyncfunctionbaixarImagem(gtin,token){consturl=`https://gtin.rscsistemas.com.br/api/gtin/img/${encodeURIComponent(gtin)}`;constres=awaitfetch(url,{headers: {"Authorization": `Bearer ${token}`}});if(res.status===404){consterr=awaitres.json();thrownewError(err.mensagem||"Produto não encontrado na base de dados");}if(res.status===204){thrownewError("Produto encontrado, porem sem imagem cadastrada");}if(!res.ok){consttxt=awaitres.text();thrownewError(`Erro ${res.status}: ${txt}`);}constblob=awaitres.blob();consturlBlob=URL.createObjectURL(blob);consta=document.createElement("a");a.href=urlBlob;a.download=`${gtin}.png`;a.click();URL.revokeObjectURL(urlBlob);}procedureBaixarImagem(const GTIN, Token, CaminhoDestino: string);
var
HTTP: TIdHTTP;
FileStream: TFileStream;
URL: string;
begin
HTTP := TIdHTTP.Create(nil);
try
HTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + Token;
URL := Format('https://gtin.rscsistemas.com.br/api/gtin/img/%s', [GTIN]);
FileStream := TFileStream.Create(CaminhoDestino + GTIN + '.png', fmCreate);
try
HTTP.Get(URL, FileStream);
finally
FileStream.Free;
end;
finally
HTTP.Free;
end;
end;- 200 OK →
image/png
- 404 Not Found
{ "mensagem": "Produto não encontrado na base de dados" }- 204 No Content
- Sempre envie o header
Authorization: Bearer <token>nos endpoints protegidos. - Trate a expiração do token solicitando um novo via
/oauth/token. - Valide o GTIN localmente antes de consultar.
- Utilize
Accept: application/jsonpara respostas estruturadas.
Desenvolvido por RSC Sistemas
🌐 https://rscsistemas.com.br
Roniery Santos Cardoso
📧 E-mail: roniery@rscsistemas.com.br
📱 WhatsApp: +55 92 4141-2737