Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

325
Visualizações
How to dynamically save a binary GET response with Postman?

So, there is a REST API which is used to migrate some data in .zip format. The API answers the GET requests with the byte content of the requested file. I use Postman to perform the requests in order to automate the migration process.

I need to save the byte response without having to click on "send and download" since I need to send multiple requests and dynamically save all the files.

I made several attempts:

  • Save the binary response as-is to a collection variable with pm.collectionVariables.set('file', responseBody) and then POST it to a localserver which reads the data and saves it to a file. This results in an invalid zip file.
  • Convert the binary data to base64 using btoa(), save the encoded string in a collection variable and then POST the base64 encoded string to a (python) localserver and decode it with base64.b64decode(data). Again, after writing the data to a file (in binary format, of course), this results in another invalid zip file.

If I click "save and download" on the postman GUI I can successfully save the zip file which is valid. Hence the API surely answers with a valid binary content.

I know that Postman uses javascript and in my localserver I use python and the mix is sub-optimal, but base64 encoding is universal, right?

Additional info which might be useful: the API answers with Content-Type: "application/octet-stream; charset=UTF-8" and Content-Disposition: attachment; filename="webseal_config.zip"; filename*=UTF-8''webseal_config.zip. I don't really understand the practical consequences of the latter header, maybe the response not only contains the binary content but also the filename and I have to process the data in some way?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda