Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move external API requests to client #5

Open
mrwunderbar666 opened this issue Mar 18, 2023 · 1 comment
Open

Move external API requests to client #5

mrwunderbar666 opened this issue Mar 18, 2023 · 1 comment
Assignees
Labels
feature new required feature refactoring

Comments

@mrwunderbar666
Copy link

Make requests to external APIs before the user sends data to Meteor. Analogous to the "Magic Button", the automatic import of data should happen while the user makes an entry.

  • Social Media related APIs only relevant for news sources
  • Entries with scientific identifier: Dataset, Archive, Tool, Scientific Publication, Author
  • All other entries can load from wikidata: Journalistic Brand, Political Party, Organization, Government, Parliament, Person, Channel, Country, Subnational, Multinational/Supranational, Language, File Type, Programming Language, Meta Variable, Concept Variable, Operation
@mrwunderbar666 mrwunderbar666 added feature new required feature refactoring labels Mar 18, 2023
@mrwunderbar666 mrwunderbar666 self-assigned this Mar 18, 2023
mrwunderbar666 added a commit that referenced this issue Jul 25, 2023
@mrwunderbar666
Copy link
Author

mrwunderbar666 commented Sep 13, 2023

Meteor API provides some endpoints for APIs that require an API key. Meteor acts as a middle man that forward the clients requests to the actual API:

  • Twitter
  • CRAN
  • DOI
  • Instagram
  • Telegram
  • vk (vkontakte)
  • Website statistics (e.g., website views)

For the APIs below, this step is not necessary, the front-end client can make those requests directly. The advantage is that there is less load on the Meteor server and the work is distributed among the clients.

Wikidata API

Get List of Suggestions:

Endpoint

https://www.wikidata.org/w/api.php

Query

https://www.wikidata.org/w/api.php?action=wbsearchentities&search=<query string>&format=json&language=en

Query Parameters as python dict:

params = {'action': 'wbsearchentities',
              'search': query, 
              'format': 'json', 
              'language': 'en'}

Get wikidata entry for a given Wikidata ID

Endpoint

https://www.wikidata.org/w/api.php

Query

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=<wikidataid>&format=json&language=en

Query Parameters as python dict:

params = {'action': 'wbgetentities', 
              'languages': 'en',
              'ids': wikidataid, 
              'format': 'json'}

PyPI

get metadata on a PyPI project

Already implemented in JavaScript: static/js/external_apis.js

Endpoint

https://pypi.org/pypi/<packagename>/json

GitHub

get metadata on a github repository

Already implemented in JavaScript: static/js/external_apis.js

##Endpoint

https://api.github.com/repos/<repository>

OpenAlex

Dynamically look up authors by name

Already implemented in Javascript, where it performs two requests at the same time. First request goes to OpenAlex, at the same time a request goes to Meteor that checks whether the Author is already present in the database: templates/helpers/_tomselect.html

Endpoint

https://api.openalex.org/autocomplete/authors

Query

  • q: string (author name)
  • author_hint=institution (what author detail should be pre-loaded to disambiguate authors)
  • mailto:[email protected] (that openalex can track our requests and put us in the "friendly requests" category

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new required feature refactoring
Projects
None yet
Development

No branches or pull requests

1 participant