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

Add links to articles from unpaywall #507

Open
elizoller opened this issue Sep 24, 2021 · 2 comments
Open

Add links to articles from unpaywall #507

elizoller opened this issue Sep 24, 2021 · 2 comments
Labels
AirTable design group an issue that came from the design group enhancement New feature or request integrations
Milestone

Comments

@elizoller
Copy link
Contributor

elizoller commented Sep 24, 2021

Use the unpaywall api to look up anything with a DOI) and display links to open access copies if available
https://unpaywall.org/products/api

@elizoller elizoller added this to the Q4 2021 milestone Sep 24, 2021
@elizoller elizoller added the design group an issue that came from the design group label Sep 24, 2021
@scottythered
Copy link

This requires sudo apt install php-curl:

<?php
function callUnpayApi($doi){
  $curl = curl_init();
  $query = "https://api.unpaywall.org/v2/" . $doi . "[email protected]";
  curl_setopt($curl, CURLOPT_URL, $query);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json'));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

  // EXECUTE:
  $result = curl_exec($curl);
  curl_close($curl);
  $response = json_decode($result, false);
  if (property_exists($response, 'HTTP_status_code')) {
    return null;
  } else {
    return $response->best_oa_location->url;
  }
}

@elizoller elizoller reopened this Jan 12, 2022
@elizoller
Copy link
Contributor Author

I ended up commenting taking this out because doing this through PHP caused more slowness of loading entities. I think the best route forward would be to use a JS component to do this asynchronously.

@seth-shaw-asu seth-shaw-asu added the enhancement New feature or request label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AirTable design group an issue that came from the design group enhancement New feature or request integrations
Projects
None yet
Development

No branches or pull requests

4 participants