Connect to web API to download a JSON file
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?
Find more posts tagged with
Sort by:
1 - 3 of
31
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 requests
import pandas as pd
import 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 HERE
password = YOUR PASSWORD GOES HERE
s = requests.Session()
link = URL GOES HERE
response = 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 results
return df
Sorry, I'm new and had to add spaces around the // to post