Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
Connect to web API to download a JSON file
realpong
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?
Find more posts tagged with
AI Studio
JSON
APIs + Webservices
Accepted answers
All comments
realpong
https: // api.bitsighttech.com/ratings/v1/companies/94063cdf-3bfa-4e16-b3b5-341da8b00c3c
Sorry, I'm new and had to add spaces around the // to post
realpong
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
sgenzer
hi
@realpong
I would use the Web Automation extension. Definitely the way to go here with both the API queries and the JSON parsing.
Scott
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups