Skip to content

Commit 8c7ea42

Browse files
push all the things to git
1 parent 372cf70 commit 8c7ea42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+234
-4383
lines changed

.DS_Store

0 Bytes
Binary file not shown.

docs/.DS_Store

0 Bytes
Binary file not shown.

docs/get.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you've ever signed into a site using Google or Facebook instead of your crede
3131
###Get API credentials
3232
API credentials consisting of a **client ID** and a **client secret** are needed in order to get Authenticated iDs and/or user permissions.
3333

34-
To get Authenticated iDs, you can use Public or Member API credentials. To get permission to read non-public information or add/update researchers' ORCID records, you'll need Member API credentials.
34+
To get Authenticated iDs, you can use Public or Member API credentials. To get permission to read non-public information or add/update researchers' ORCID records, you'll need Member API credentials. For the rest of this tutorial, when referring to the API please assume that it is the Member API that is being referenced.
3535

3636
For this tutorial, please use your own sandbox API credentials:
3737

@@ -56,34 +56,33 @@ To kick off the OAuth process, we'll need to create a special authorization URL
5656
|**scope**| API action(s) you want to request permission for, from the list of [ORCID Scopes](https://members.orcid.org/api/oauth/orcid-scopes). | ```/authorize``` <br> ```/activities/update```
5757
|**redirect_uri**| Page on your site that users will see after they complete the authorization process (must be on the list of allowed redirect URIs you specified when requesting your API credentials) | ```https://developers.google.com/oauthplayground``` |
5858

59-
To request permission to add/update activities (affiliations, funding, works, peer review items), our authorization URL will be:
60-
Enter you own client ID where it says [APP-*****************]
61-
```
62-
https://sandbox.orcid.org/oauth/authorize?client_id=[APP-****************]&response_type=code&scope=/read-limited%20/activities/update%20/person/update&redirect_uri=https://developers.google.com/oauthplayground
63-
```
6459

6560
###Get an authorization Code
6661

67-
1. Copy the below URL, remembering to fill in your own APP details and paste into a new tab.<br>
68-
62+
1. To request permission to add/update activities (affiliations, funding, works, peer review items), our authorization URL will be:
6963
```
7064
https://sandbox.orcid.org/oauth/authorize?client_id=[APP-****************]&response_type=code&scope=/read-limited%20/activities/update%20/person/update&redirect_uri=https://developers.google.com/oauthplayground
7165
```
7266

67+
Enter you own client ID where it says [APP-*****************]
68+
69+
Copy your URL, remembering to fill in your own APP details and paste into a new tab and press enter.<br>
70+
71+
7372
2. An ORCID sign-in screen listing the requested permissions will appear; sign into your Sandbox account and click **Authorize**<br>
7473
<img src="../images/04-2_oauth-screen.png" width="400" alt="ORCID OAuth sign-in screen" />
7574
3. After granting permission, you'll be redirected to the Google OAuth Playground. A 6-character code will appear at the end of the redirect URI in the browser address bar (and under the **Step 2** section at left)<br>
7675
<img src="../images/04-2_auth-code-address.png" width="400" alt="ORCID OAuth sign-in screen" /><br><br>
7776
<img src="../images/04-2_auth-code.png" width="400" alt="Browser address bar showing OAuth authorization code" />
7877

79-
###Exchange authorization code for access token & authenticated iD
78+
###Exchange authorization code for access token and authenticated iD
8079
Once you have an Authorization Code, you can exchange it for an Access Token and the Authenticated iD of the user who signed in, which you'll need in order to take the API action(s) you requested permission for. You need to store this securely and privately as it contains access tokens, normally you would store this in a database, for now you can store it in a text file on your computer.
8180

8281
In a real-world situation, this exchange would be done by your system, using a programming language such as PHP, Java, or Ruby on Rails. For this tutorial, we'll use Google OAuth Playground to simulate a web application.
8382

8483
1. Click the gear icon in the upper right corner to open the **OAuth 2.0 Configuration**<br>
8584
<img src="../images/04-3_google-playground-config.png" width="400" alt="Google OAuth Playground OAuth 2.0 Configuration" />
86-
2. Enter the following settings and click **Close**
85+
2. Change the Oauth endpoints drop down to custom and enter the following settings and click **Close**
8786

8887
| Field | Value |
8988
| ------| ------|
@@ -100,4 +99,11 @@ In a real-world situation, this exchange would be done by your system, using a p
10099
4. Your Access Token and Authenticated iD will appear **Request/Response** section at right.<br>
101100
<img src="../images/04-3_token-response.png" width="600" alt="Google OAuth Playground json response for an access token request" /> <!--update with XML-->
102101

102+
103+
**Save this token**
104+
105+
It is important to save the token you received in the step above as you can easily create any calls you need to make with it. If you loose the token you will have to go through the whole process above again.
106+
103107
Once you have gone through this process once and you have the token this is all that you need to do further api calls for this ORCID and for these permissions. If you want to make calls for another ORCID or you want to write to a record where before you have only read for example, then you will need to complete the process again and get a new token.
108+
109+

docs/images/06-1_headers.png

-101 KB
Loading

docs/images/06-2_put-code.png

95.9 KB
Loading

docs/post.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
Now that we've got an Access Token, we can use it like a password to take the API actions we requested permission for.
21

3-
In this section, we'll add an education affiliation to our Sandbox record. You can use the API to, POST (add), PUT (update), DELETE, or read any section of the record, the only things you need to change are the endpoints and the XML for each section. In the following example we are using the /education endpoint with the [correct XML](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.1/samples/write_sample/education-2.1.xml) to add the information, but you can just as well add Employment or Works for example. See our [Github documentation](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.1/README.md) for more example files and endpoints and the permissions you need for each.
2+
In this section, we'll add an education affiliation to our Sandbox record. As you have seen you can use the API to GET (read) items on the record, you can also POST (add), PUT (update), DELETE, any section of the record, the only things you need to change are the endpoints and the XML for each section. In the following example we are using the /education endpoint with the [correct XML](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_3.0/samples/write_sample/education-3.0.xml) to add the information, but you can just as well add Employment or Works for example. See our [Github documentation](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_3.0/README.md) for more example files and endpoints and the permissions you need for each.
43

54
##Add an education affiliation
6-
Still have that Google OAuth Playground window open? If so, continue with step 1 below. If not, go back and repeat the [Get an authorization code](/collect/#get-an-authorization-code) and [Exchange authorization code for an access token](/collect/#exchange-authorization-code-for-access-token-authenticated-id) steps from the previous section before moving on to the steps below.
5+
Still have that Google OAuth Playground window open? If so, continue with step 1 below. If not, you have two options, If you saved your authorization token from earlier fill out the Oauth Playground window as you had it on [Read the record](read.md) or if not, go back and repeat the [Get an authorization code](get.md) and [Exchange authorization code for an access token](get.md#Exchange-authorization-code-for-access-token-and-authenticated-iD) steps from the previous section before moving on to the steps below. -->
76

87
1. Beneath **Step 3: Configure request to API**, set **HTTP Method** to **POST**.<br>
98
<img src="../images/06-1_http-method-post.png" width="400" alt="Google OAuth Playground HTTP method set to POST" />
10-
2. Click **Add headers**, enter the values below, then click **Add** and **Close**
9+
2. Click **Add headers**, remove any previous headers and enter the values below, then click **Add** and **Close**
1110
- **Header name:** ```accept```
1211
- **Header value:** ```application/vnd.orcid+xml```
1312
<br>
1413
<img src="../images/06-1_header-accept.png" width="400" alt="Google OAuth Playground adding accept header" />
1514
5. In the **Request URI** field enter:<br>
16-
```https://api.sandbox.orcid.org/v2.0/[ORCID ID]/education```<br>
15+
```https://api.sandbox.orcid.org/v3.0/[ORCID ID]/education```<br>
1716
*Replace [ORCID ID] with the iD for your Sandbox record, format XXXX-XXXX-XXXX-XXXX*<br>
1817
<img src="../images/06-1_request-uri.png" width="400" alt="Google OAuth Playground request URI configuration for adding an education affiliation" />
1918
3. Click **Content-type** > **Custom** and enter ```application/vnd.orcid+xml```<br>
@@ -37,27 +36,37 @@ Still have that Google OAuth Playground window open? If so, continue with step 1
3736
```
3837
<?xml version="1.0" encoding="UTF-8"?>
3938
<education:education
40-
xmlns:common="http://www.orcid.org/ns/common" xmlns:education="http://www.orcid.org/ns/education"
41-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
42-
xsi:schemaLocation="http://www.orcid.org/ns/education ../education-2.0.xsd ">
43-
<education:department-name>Department</education:department-name>
44-
<education:role-title>Degree title</education:role-title>
45-
<common:start-date>
46-
<common:year>2012</common:year>
47-
<common:month>01</common:month>
48-
<common:day>01</common:day>
49-
</common:start-date>
50-
<education:organization>
51-
<common:name>ORCID</common:name>
52-
<common:address>
53-
<common:city>Bethesda</common:city>
54-
<common:region>Region</common:region>
55-
<common:country>US</common:country>
56-
</common:address>
57-
<common:disambiguated-organization>
58-
<common:disambiguated-organization-identifier>385488</common:disambiguated-organization-identifier>
59-
<common:disambiguation-source>RINGGOLD</common:disambiguation-source>
60-
</common:disambiguated-organization>
61-
</education:organization>
39+
xmlns:common="http://www.orcid.org/ns/common" xmlns:education="http://www.orcid.org/ns/education"
40+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
41+
xsi:schemaLocation="http://www.orcid.org/ns/education ../education-3.0.xsd ">
42+
<common:department-name>department-name</common:department-name>
43+
<common:role-title>role-title</common:role-title>
44+
<common:organization>
45+
<common:name>common:name</common:name>
46+
<common:address>
47+
<common:city>common:city</common:city>
48+
<common:region>common:region</common:region>
49+
<common:country>AF</common:country>
50+
</common:address>
51+
<common:disambiguated-organization>
52+
<common:disambiguated-organization-identifier>http://dx.doi.org/10.13039/100000001</common:disambiguated-organization-identifier>
53+
<common:disambiguation-source>FUNDREF</common:disambiguation-source>
54+
</common:disambiguated-organization>
55+
</common:organization>
56+
<common:url>http://tempuri.org</common:url>
57+
<common:external-ids>
58+
<common:external-id>
59+
<common:external-id-type>grant_number</common:external-id-type>
60+
<common:external-id-value>external-identifier-value</common:external-id-value>
61+
<common:external-id-url>http://tempuri.org</common:external-id-url>
62+
<common:external-id-relationship>self</common:external-id-relationship>
63+
</common:external-id>
64+
<common:external-id>
65+
<common:external-id-type>grant_number</common:external-id-type>
66+
<common:external-id-value>external-identifier-value2</common:external-id-value>
67+
<common:external-id-url>http://tempuri.org/2</common:external-id-url>
68+
<common:external-id-relationship>self</common:external-id-relationship>
69+
</common:external-id>
70+
</common:external-ids>
6271
</education:education>
6372
```

docs/put.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
In a real-world situation, you may need to update a researcher's affiliation. In this section, we'll update our education affiliation to include an end date.
22

3+
##A little about Put-codes
4+
5+
Put codes are short numeric codes that reference a particular item on the ORCID record. You use the put-code with the API calls to update, delete or read a particular item ( as opposed to a summary of items.)
6+
To find out the put-code for a particular item we just need to read the record or a summary of the item we are interested in. The put-code for the item we want to modify will be returned in the response. See the XML below as an example.
7+
8+
In the example below we are updating a single education item.
39
##Update an education affiliation
410

5-
1. In the **Request/Response** section at right, find the **put-code** for the education affiliation that you added in the previous section.<br>
11+
1. First we need to get a **put code** for the work you just added so open a new Google Playground window and set it up following the first 4 steps from the [Read the record](read.md) .
12+
13+
2. This time in the Request URI field enter ```https://api.sandbox.orcid.org/v3.0/0000-XXXX-XXXX-XXXX/educations``` . Note that we have added 'educations' to the end of the URI and that it is plural. This means we are fetching a summary of all the education items on this record, not just one (we would put it singular and added / with a put code of the item at the end)
14+
15+
3. Hit the 'Send the request' and you should see something like the image below in the **Request/Response** section. Find the **put-code** for the education affiliation that you added in the previous section (it will be a different number to the one highlighted here).<br>
616
<img src="../images/06-2_put-code.png" width="600" alt="Detailed view of Google OAuth Playground response for successful education affiliation POST request showing put-code" />
717
2. Change **HTTP Method** to **PUT**<br>
818
<img src="../images/06-2_http-method-put.png" width="400" alt="Google OAuth Playground HTTP method set to PUT" />
919
3. Click **Add Headers** and make sure that ```accept``` and ```Content-type``` are both set to ```application/vnd.orcid+xml```<br>
1020
<img src="../images/06-2_put-headers.png" width="400" alt="Google OAuth Playground accept and Content-type header configuration" />
1121
3. In the **Request URI** field enter:<br>
12-
```https://api.sandbox.orcid.org/v2.0/[ORCID ID]/education/[PUT CODE]```<br>
22+
```https://api.sandbox.orcid.org/v3.0/[ORCID ID]/education/[PUT CODE]```<br>
1323
*Replace [ORCID ID] with the iD for your Sandbox record, format XXXX-XXXX-XXXX-XXXX and [PUT CODE] with the put-code for your education affiliation*<br>
1424
<img src="../images/06-2_request-uri.png" width="400" alt="Google OAuth Playground request URI configuration for updating an education affiliation" />
15-
2. Click **Enter request body** (the XML for the affiliation you added in the previous step should appear).
25+
2. Grab the XML from the end of the [POST](post.md) section again and the click **Enter request body** and paste it in.
1626
3. Inside the ```<education:education``` tag, add ```put-code=[PUT CODE]```<br>
1727
*Replace [PUT CODE] with the put-code for your education affiliation, ex ```<education:education put-code="26971"```*<br>
1828
<img src="../images/06-2_request-body-1.png" width="600" alt="Google OAuth Playground Request Body configuration for updating an education affiliation showing where to place put-code" />
19-
4. Copy the affiliation end date XML at the end of this section and paste it beneath the ```</common:start-date>``` tag (and above the ```<education:organization>``` tag)<br>
29+
4. Copy the Affiliation start and end date XML at the end of this section and paste it beneath the ```</common:role-title>``` tag (and above the ```<common:organization>``` tag)<br>
2030
<img src="../images/06-2_request-body-2.png" width="600" alt="Google OAuth Playground Request Body configuration for updating an education affiliation showing where to place end-date XML" />
2131
5. Click **Close**.
2232
6. Click **Send the Request**.
@@ -25,12 +35,17 @@ In a real-world situation, you may need to update a researcher's affiliation. In
2535
8. Visit the **public view** of your Sandbox record at ```https://sandbox.orcid.org/[ORCID ID]``` to see your updated education affiliation.<br>
2636
<img src="../images/06-2_updated-affiliation.png" width="600" alt="ORCID record with updated education affiliation item" /><br>
2737

28-
##Affiliation end date XML
38+
##Affiliation start and end date XML
2939

3040
```
41+
<common:start-date>
42+
<common:year>1948</common:year>
43+
<common:month>02</common:month>
44+
<common:day>02</common:day>
45+
</common:start-date>
3146
<common:end-date>
32-
<common:year>2017</common:year>
33-
<common:month>01</common:month>
34-
<common:day>31</common:day>
47+
<common:year>1948</common:year>
48+
<common:month>02</common:month>
49+
<common:day>02</common:day>
3550
</common:end-date>
3651
```

docs/resources.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
* Technical documentation [ORCID Github](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.1/README.md)
33
* ORCID API users group [https://groups.google.com/group/orcid-api-users](https://groups.google.com/group/orcid-api-users)
44
* ORCID Support [support@orcid.org](mailto:support@orcid.org)
5+
* API Tutorials Technical [https://github.com/ORCID/ORCID-Source/tree/master/orcid-api-web/tutorial](https://github.com/ORCID/ORCID-Source/tree/master/orcid-api-web/tutorial)

docs/sandbox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Before you can edit information on your ORCID record, you'll need to verify your
2828
*Make note of the 16-digit iD for your Sandbox record - you'll need this throughout the rest of the tutorial!*<br>
2929
<img src="../images/01-2_new-record.png" width="600" alt="New ORCID Sandbox record" />
3030

31-
##Add info to your Sandbox record
31+
##<a name ="Add"></a>Add info to your Sandbox record
3232
1. **Add a country:** Click the pencil icon beside Country, choose a country and click **Save changes**.<br>
3333
<img src="../images/01-3_edit-country.png" width="400" alt="ORCID edit country screen" />
3434
2. **Add employment:** In the **Employment** section, click **Add employment** > **Add manually**, fill out the form and click **Add to list**.<br>

mkdocs.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ extra:
99
logo:
1010
icon:
1111
'docs/images/id-icon.svg'
12-
pages:
12+
nav:
1313
- 1. Introduction: index.md
1414
- 2. Set up the Sandbox: sandbox.md
1515
- 3. GET&#58; authenticated iDs &amp; permission: get.md
16-
- 4. POST&#58; an affiliation: post.md
17-
- 5. PUT&#58; Update an affiliation: put.md
18-
- 6. DISPLAY&#58; Presenting ORCID in your system: display.md
19-
- 7. RESOURCES: resources.md
20-
- 8. Other methods for getting authorised iDs: Other_methods_for_getting_authorised_iDs.md
16+
- 4. READ&#58; the record: read.md
17+
- 5. POST&#58; an affiliation: post.md
18+
- 6. PUT&#58; Update an affiliation: put.md
19+
- 7. DISPLAY&#58; Presenting ORCID in your system: display.md
20+
- 8. RESOURCES: resources.md
21+
- 9. Other methods for getting authorised iDs: Other_methods_for_getting_authorised_iDs.md

0 commit comments

Comments
 (0)