• advertisement_alt
  • advertisement_alt
  • advertisement_alt
Cleiton Fidelis

Extrair conteudo zip base64 json

4 posts in this topic

Prezados,

Estava estudando por aprendizado a API REST de Cobrança do Banco Sicoob
Sicoob | Open Banking
Quando se faz o cadastro, você recebe as credenciais, conta, senha , bem legal.

Url ->Cobrança Bancária
Autenticação->Pessoa Jurídica..

o Recurso par Download de movimentação.
Ele retorna um json contendo um Zip em Base64

Alguma sugestão de como eu possa extrair esse conteúdo e converte-lo ?
Eu tentei assistindo aula de @Amarildo de Matos DICAS 3371 WINDEV WEBDEV MOBILE NFeDistribuicaoDFe Parte 2 doczip relacao resumo notas em windeV Cur - YouTube   aos 4:13  mas não consegui.

Aqui o Exemplo de json de resposta que fala para extrair o conteudo zip base64

{ "resultado": { "arquivo": "UEsDBBQAAAAIAMOUwp3Ci05RwpzCqzLDsQEAAMO5GwAAMAAAAEVOVFJfMzA2Nl8xODkxODlfMjAxOTA0MTAxODE0NDQzMjQ1MTM0XzI2XzAuanNvbsOtw5bDkWvDnCAYAMOwf2XDpDkZwp9GwqPDqcObw5rCu8Kxw4HCtcKUw7UowowxwoZEdwhJLCbDqcOLw5jDvz7Do13DmzBCw6NDS0pRcsOHw4V8w4bDr8OTH8KHP8O+JFrDnsKYWlfCuhfClTDDl8OWVMKqw6tEwqPDmsOeXMKae8OtfyRnwpjCpUk7NMKfDnbCuBPCpz5IwpPDisOIwr3CvsKbBsKiNMOpw7TCoRbCk8KuZHvCtcO/wpbCpMKJFMK9w7jDmsK6wpnDjMO0IQbDhDMoMwx7woAzf2XCkMK7w6/Dk8KIw4/CusKZDcOHw7PDoV/CjBVzw7U8DS8zIBlCw78Pw7fDtV3DlMOaBSpXBi/DnXXDrDNtb8KFG8O9w5jCqcOlwqXCkcKiw5ZSSMOlJsKQwoN/w6jCg8O3wrofanfCl1NUwrjChFRXw53CqMOhamjClB1nw5/CuHvDtzbCk8OtNsK7U8K+wrfCqsKtwo7DhcO5wqFPOcOSDMONwqzDiMK9wqjCjX3CiMOkw7QjwrjDpsK3QR/DjMK5wrBWdMOuBcKMFiVjHBPDsMKNUwDClENRAMKCYwljw6/CmMKhw6s/wqYxbsOXdixTwopJAmx+wonCt8KNditqNsKmGkI3ccKnG8OdwqtrccOwG8OxfMKRwo/Ciy4uwozCtcKnw60gGGN4KF9Yw717CgzDvDLDvE3Co8OlV8KywozDs1Utw5Nlw4s4wo/ClsKjw6UQw4s5wqxqOV/CtsKcQ8K0HC3Ch1gmfFXDi2jDmTLDocORcsK0HGLCmcOSwrduwpnDkmg5Wg7CsVzDoFUtw7Nlw4sFwo7ClsKjw6UQw4tsw53Ds3LDgMO/MsKLw6fDpWg5w4gyZ8KrWibDi8KWOcKLwpbCo8OlEMOLJVnDlTJewrZcwpJoOVoOwrBcw7DCmTPDhsOtw67DvMOXZsO7w73Dg8OYXsOAMn7DrsKMw4EJdsKGw53Ch8KScsOOwrLDi8Owwp3CnTF+w74DUEsBAj8AFAAAAAgAw5TCncKLTlHCnMKrMsOxAQAAw7kbAAAwACQAAAAAAAAAIAAAAAAAAABFTlRSXzMwNjZfMTg5MTg5XzIwMTkwNDEwMTgxNDQ0MzI0NTEzNF8yNl8wLmpzb24KACAAAAAAAAEAGADCsMKtw6pswrjDsMOUAQDDr8OJwofDrsOvw5QBAMOvw4nCh8Ouw6/DlAFQSwUGAAAAAAEAAQDCggAAAD8CAAAAAA==", "nomeArquivo": "ENTR_3066_189189_201904260922011189887_47_0.zip" }}




Sugestões ???

 

 

2022-01-18 20_34_38-Sicoob _ Open Banking e mais 8 páginas - Perfil 1 — Microsoft​ Edge.png

Share this post


Link to post
Share on other sites

eu ia sugerir fazer igual do retorno da NFe vc basicamente faz um Decode no Base64 e depois um Unzip, posta teu código pra avaliarmos.

Share this post


Link to post
Share on other sites
20 horas atrás, Cassiano disse:

eu ia sugerir fazer igual do retorno da NFe vc basicamente faz um Decode no Base64 e depois um Unzip, posta teu código pra avaliarmos.

sjson is JSON = [
{ "resultado": { "arquivo": "UEsDBBQAA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vMOXZsO7w73Dg8OYXsOAMn7DrsKMw4EJdsKGw53Ch8KScsOOwrLDi8Owwp3CnTF+w74DUEsBAj8AFAAAAAgAw5TCncKLTlHCnMKrMsOxAQAAw7kbAAAwACQAAAAAAAAAIAAAAAAAAABFTlRSXzMwNjZfMTg5MTg5XzIwMTkwNDEwMTgxNDQ0MzI0NTEzNF8yNl8wLmpzb24KACAAAAAAAAEAGADCsMKtw6pswrjDsMOUAQDDr8OJwofDrsOvw5QBAMOvw4nCh8Ouw6/DlAFQSwUGAAAAAAEAAQDCggAAAD8CAAAAAA==", "nomeArquivo": "ENTR_3066_189189_201904260922011189887_47_0.zip" }}
]


bufBContent    is Buffer            = Decode(sjson.resultado.arquivo,encodeBASE64)
bufBdescomprimido is Buffe     = Uncompress(bufBContent)
sResultadoContent is string      = bufBdescomprimido

Rode ai pra ver..

Em minha cabeça.. o resultado deveria ser algo Compreensivel , ja decodificado, e zipado, seria isso mesmo ???

 

Share this post


Link to post
Share on other sites

Testei aki e não deu certo, o estranho é q em Harbour eu faço exatamente isso Decodifico na Base64 depois Unzip e pronto

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now