Search code examples
pythonacademic-graph

Get Information from Microsoft Academic Graph API


I am trying to use the Microsoft Academic Graph API with Python, to get information about the Author's Affiliations. However, the information provided in

https://learn.microsoft.com/en-us/azure/cognitive-services/academic-knowledge/graphsearchmethod

is not clear to me.

I have also read Microsoft Academic Graph Search - retrieving all papers from a journal within a time-frame?

I am trying with something like this:

import requests

url = "https://westus.api.cognitive.microsoft.com/academic/v1.0/graph/search"

querystring = {"mode":"json%0A"}

payload = "{}"

response = requests.request("POST", url, data=payload, params=querystring)

print(response.text)

What should I put in "payload" to retrieve the affiliation of, for example, the Author "John Doe" ?


Solution

  • It seems you are using the wrong endpoint. As for anything experimental the documentation seems out of date. I have had success calling https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate These endpoints can be seen in the cognitive labs documentation.

    I am yet to figure out how to retrieve academic profiles, as the query below yields no results, whereas academic.microsoft.com has loads.

    https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate?expr=Composite(AA.AuN='Harry L. Anderson')&model=latest&count=10&attributes=Id,Ti,AA.AuN,E,AA.AuId

    Hope this may help anyone stumbling upon this.

    Update :

    Here is a working query for the same author : https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate?model=latest&count=100&expr=Composite(AA.AuN=='harry l anderson')&attributes=Id,Ti,AA.AuN,E,AA.AuId

    Notice the author name has to be in lowercase.