how to get the works information using the api

153 views
Skip to first unread message

Shinya Koizumi

unread,
Sep 11, 2018, 8:06:23 AM9/11/18
to ORCID API Users
I am developer working on my client website and display data on the website using this api.
I was wondering why I am not getting json information. I was told to use https://pub.orcid.org/0000-0000-0000-0000(orcid)/works but getting 
CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mydomain.dk' is therefore not allowed access.

Do I need to get authenticated first with public client_id and secret code? If so where can I find it? 

$.ajax({
headers: {          
Accept: "application/orcid+json",         
},
dataType: 'json',    
success : function(response) { 
  }
});

Vincent

unread,
Sep 11, 2018, 8:15:05 AM9/11/18
to Shinya Koizumi, ORCID API Users
Hi Shinya,

Unfortunately, it appears that ORCID does not allow calls to the API from within the browser - I ran into this earlier here: https://support.orcid.org/forums/175591-orcid-ideas-forum/suggestions/17805697-add-access-control-allow-headers-authorizatio

Thus, the only way to get around this is by having your back-end make the request, and then have your front-end call that back-end.

Good luck,
Vincent

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/d/optout.

Peters, Robert

unread,
Sep 11, 2018, 12:10:13 PM9/11/18
to Vincent, Shinya Koizumi, ORCID API Users
The post linked to is about fetching access tokens, not fetching records with access tokens.

The url you are using is incorrect. It should be: 
   https://pub.orcid.org/v2.1/[numeric part of and ORCID iD]/works
ie:

Robert Peters
Technology Director at ORCID.org

Cellphone: +1.805.440.9056
Skype: rcpeters
Timezone: PST
Key for OpenPGP email communication:  
https://keys.mailvelope.com/pks/lookup?op=get&search=0x1519F37D99E18378

On Tue, Sep 11, 2018 at 5:14 AM, Vincent <opena...@vincenttunru.com> wrote:
Hi Shinya,

Unfortunately, it appears that ORCID does not allow calls to the API from within the browser - I ran into this earlier here: https://support.orcid.org/forums/175591-orcid-ideas-forum/suggestions/17805697-add-access-control-allow-headers-authorizatio

Thus, the only way to get around this is by having your back-end make the request, and then have your front-end call that back-end.

Good luck,
Vincent
On Tue, Sep 11, 2018 at 2:06 PM Shinya Koizumi <sh.ko...@gmail.com> wrote:
I am developer working on my client website and display data on the website using this api.
I was wondering why I am not getting json information. I was told to use https://pub.orcid.org/0000-0000-0000-0000(orcid)/works but getting 
CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mydomain.dk' is therefore not allowed access.

Do I need to get authenticated first with public client_id and secret code? If so where can I find it? 

$.ajax({
headers: {          
Accept: "application/orcid+json",         
},
dataType: 'json',    
success : function(response) { 
  }
});

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Shinya Koizumi

unread,
Sep 18, 2018, 12:39:49 AM9/18/18
to r.pe...@orcid.org, Vincent, orcid-a...@googlegroups.com
Thanks guys for the help. I was able to fetch the info using like this in php. 

<?php


// Initializing curl
$ch = curl_init( $json_url );

// Configuring curl options
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array("Content-type: application/json")
);

// Setting curl options
curl_setopt_array( $ch, $options );

// Getting results
$result = curl_exec($ch); // Getting jSON result string
var_dump($result);

?>

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages