my code is
if name == 'main': json_data=requests.get("https://www.ebi.ac.uk/europepmc/annotations_api/annotationsByArticleIds?articleIds=PMC%3A4771370§ion=Abstract&provider=Europe%20PMC&format=JSON").content r=json.loads(json_data) df = json_to_dataframe(r) print(df)
My only problem is how can run this for multiple IDs, like i have atleast thousands of ids in a file. Please help I'm using python.
Assuming you know Python and can get all the IDs from the file into a list article_ids
, you can use the following script:
URL = 'https://www.ebi.ac.uk/europepmc/annotations_api/annotationsByArticleIds'
article_ids = ['PMC:4771370']
for article_id in article_ids:
params = {
'articleIds': article_id,
'section': 'Abstract',
'provider': 'Europe PMC',
'format': 'JSON'
}
json_data = requests.get(URL, params=params).content
r = json.loads(json_data)
df = json_to_dataframe(r)
print(df)