Download a file via REST API from Excel?

Rainer Hitzeman
Kilo Explorer

Hi to everybody!

Hopefully I'm in the correct forum. I've managed do transfer data from a Servicenow instance to an Excel spreadsheet via REST API, mainly using code from this page: https://www.servicenowelite.com/blog/2015/9/22/connect-servicenow-to-microsoft-excel-with-rest-webse...

Where I've failed is to download a binary file (zip) from Servicenow. I have the url to download a file after I have provided my login data, but I'm still unable to automate the process via Excel and VBA.

Any help is greatly appreciated!

Rainer

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so what is the error when you consume the API?

Any authentication issue?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello Ankur,

a zip-file is downloaded, but it's not valid. I can't open it with 7zip and when I try to open it with firefox, the file only seems to contain the request, where the file should be saved.

Regards, Rainer

Hi,

So it means the request is not being fulfilled properly with the API

Is this happening with every file

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Rainer Hitzeman
Kilo Explorer

Hi,

it seem to happen with every file type. The downloaded file obviously contains the code from the website instead of the file data.

I've tried different approaches to download a file and save automatically, but none was suucessful so far. Problem seems to be to provide the correct authentication data, but that's also a guess.

Regards, Rainer