-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstep2.html
70 lines (66 loc) · 1.95 KB
/
step2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Step 2</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
var getORCIDMetadata = function(orcid){
$.ajax({
headers: {
Accept: "application/json"
},
type: "GET",
url: "http://pub.orcid.org/v2.0_rc1/"+orcid+"/activities",
success: function (data) {
if (data) {
getDOIMetadata(data);
} else {
$("#result").text("no result...");
}
},
error: function (jqXHR, textStatus, errorThrown) {
$("#result").text("error: " + textStatus);
}
});
}
var getDOIMetadata = function(data){
data.works.group.forEach(function(obj){
if ( obj.identifiers.identifier[0]["external-identifier-type"] == "doi" ){
$.ajax({
headers: {
//change this to application/x-bibtex or application/json or application/RIS
//or "application/vnd.citationstyles.csl+json"
// or "text/x-bibliography; style=apa"
Accept : "text/x-bibliography; style=apa"
},
type: "GET",
url: "http://dx.doi.org/"+obj.identifiers.identifier[0]["external-identifier-id"],
success: function (data) {
if (data){
$("#result").append(data+"<br/>");
}else{
$("#result").append("no result for "+obj.ID+"<br/>");
}
},
error: function (jqXHR, textStatus, errorThrown ) {
$("#result").append("error: "+textStatus+"<br/>");
}
});
} else {
//let's skip this for the moment
//we need to fetch citeproc-JSON from ORCID
//the use citeproc-js to format it!
//see https://github.com/ORCID/orcid-js which does it!
}
});
}
getORCIDMetadata("0000-0003-0902-4386");
</script>
</head>
<body>
<h1>Step 2: Get a list of works for an ORCID ID and their DOI metadata</h1>
<pre id="result"></pre>
<a href="step3.html">next step</a>
</body>
</html>