Connect to web API to download a JSON file
realpong
New Altair Community Member
I'm trying to connect to an API using the following URL.
ratings/v1/companies/94063cdf-3bfa-4e16-b3b5-341da8b00c3c
I have a username and the password is NULL. When I use Chrome, I enter these credentials. When I use IE, I am presented the option to download a JSON file.
I tried using Enrich Data by Webservice but get an error "Could not access URL".
Can anyone offer a solution?
ratings/v1/companies/94063cdf-3bfa-4e16-b3b5-341da8b00c3c
I have a username and the password is NULL. When I use Chrome, I enter these credentials. When I use IE, I am presented the option to download a JSON file.
I tried using Enrich Data by Webservice but get an error "Could not access URL".
Can anyone offer a solution?
Tagged:
0
Answers
-
https: // api.bitsighttech.com/ratings/v1/companies/94063cdf-3bfa-4e16-b3b5-341da8b00c3c
Sorry, I'm new and had to add spaces around the // to post0 -
Built something using Python instead to grab the JSON file and throw the data I needed into a table. Sorry, the appropriate indentation didn't copy over. Also, all the lines with 'rating%' or 'range%' is only relevant to the site I was using if anyone tries this using another URL.import requestsimport pandas as pdimport json# rm_main is a mandatory function,# the number of arguments has to be the number of input ports (can be none)def rm_main():username = YOUR USERNAME GOES HEREpassword = YOUR PASSWORD GOES HEREs = requests.Session()link = URL GOES HEREresponse = s.get(link, auth = (username, password), verify = False)data = json.loads((response.content).decode('utf-8'))temp = []ratings = data['ratings']for i in ratings:rating_date = i['rating_date']rating = i['rating']range_nm = i['range']rating_color = i['rating_color']temp.append([rating_date, rating, range_nm, rating_color])df = pd.DataFrame(temp,columns = ['rating_dt','rating', 'range_nm', 'rating_color'])# connect 2 output ports to see the resultsreturn df1