步驟 3 (共 5)
3. 寫信給 ORCID 記錄 (POST)
恭喜! 您已完成所有設置並正在收集 ID 和權限 - 現在是有趣的部分! 在本課中,您將學習如何將數據寫入 ORCID 記錄。
在本節中,我們將向您的沙盒記錄添加“教育”從屬關係。
在以下示例中,我們將 /education 端點與 正確的 XML 添加信息,但您也可以添加例如就業或工作。 查看我們的 Github 文檔 有關更多示例文件和端點以及您需要的權限。
以下是可用於本練習的示例 Education XML:
<?xml version="1.0" encoding="UTF-8"?>
<education:education
xmlns:common="http://www.orcid.org/ns/common" xmlns:education="http://www.orcid.org/ns/education"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.orcid.org/ns/education ../education-3.0.xsd ">
<common:department-name>department-name</common:department-name>
<common:role-title>role-title</common:role-title>
<common:start-date>
<common:year>1948</common:year>
<common:month>02</common:month>
<common:day>02</common:day>
</common:start-date>
<common:end-date>
<common:year>1948</common:year>
<common:month>02</common:month>
<common:day>02</common:day>
</common:end-date>
<common:organization>
<common:name>common:name</common:name>
<common:address>
<common:city>common:city</common:city>
<common:region>common:region</common:region>
<common:country>AF</common:country>
</common:address>
<common:disambiguated-organization>
<common:disambiguated-organization-identifier>http://dx.doi.org/10.13039/100000001</common:disambiguated-organization-identifier>
<common:disambiguation-source>FUNDREF</common:disambiguation-source>
</common:disambiguated-organization>
</common:organization>
<common:url>http://tempuri.org</common:url>
<common:external-ids>
<common:external-id>
<common:external-id-type>grant_number</common:external-id-type>
<common:external-id-value>external-identifier-value</common:external-id-value>
<common:external-id-url>http://tempuri.org</common:external-id-url>
<common:external-id-relationship>self</common:external-id-relationship>
</common:external-id>
<common:external-id>
<common:external-id-type>grant_number</common:external-id-type>
<common:external-id-value>external-identifier-value2</common:external-id-value>
<common:external-id-url>http://tempuri.org/2</common:external-id-url>
<common:external-id-relationship>self</common:external-id-relationship>
</common:external-id>
</common:external-ids>
</education:education>
返回 Google Developers OAuth 2.0 Playground 的瀏覽器選項卡。 如果您沒有保持該選項卡打開,則可以使用之前保存的 URL 重新初始化會話(在出現的警告上單擊“確定”)。 或者,您可以通過填寫所有相關字段來再次設置通話,確保它們類似於下面的屏幕截圖:
確保 組態 有你的 客戶 ID 和客戶秘密
在 google oauth 遊樂場中的第 2 步下方,您應該有 訪問令牌 填寫
它應該仍然具有之前的令牌,或者您可以從上一個練習中填寫它,如下所示:
在 Google Developers OAuth 3 Playground 中的第 2 步下方,單擊 添加標題,輸入下面的值,然後單擊 加入 和 關閉
Header name: Accept
Header value: application/vnd.orcid+xml
第 3 步下方:配置 請求 至 API,設定 HTTP 方法 至 郵政。
在 請求URI 字段輸入:
https://api.sandbox.orcid.org/v3.0/[ORCID ID]/education
代替 [ORCID ID]與 iD 對於您的沙盒記錄,格式為 XXXX-XXXX-XXXX-XXXX,您收集了與之交互的權限。
點擊 內容類型 > 習俗 並進入
application/vnd.orcid+xml
點擊 加入,然後單擊 關閉.
點擊 輸入請求正文.
複製本節頂部的教育從屬關係 XML 並將其粘貼到 請求正文 文本框:
可選的: 在 請求正文 文本框,編輯 XML 以反映您的機構。 為了, 使用 ROR 註冊表 找到 ROR ID 為您的機構n.
點擊 關閉.
點擊 發送.
結果將出現在 請求/響應 右側部分。 滾動到回复的底部 - 如果您看到 HTTP/1.1 201 創建,您的教育背景已成功添加! 下面您可以看到 XML 如何與底部的 201 創建消息一起出現的示例摘錄。
... <common: month>01</common: month> <common: day>01</common: day>
</ common: start-date> <education:organization>
<common: name>My University</common: name> <common: address>
<common: city>Some City</common:city> <common: region>Region</common: region> <common: country>US</common:country>
</ common: address>
HTTP/1.1 201 Created
Content length. A X-xss-protection: 1; mode=block X-content-type-options: nosniff
Expires: 0
Server: nginx/1.10.0
Connection: keep-alive
Location: http://api.sandbox.orcid.org/v3.0/0000-0002-4456-8947/education 26971
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Thu, 15 Jun 2017 20:44:09 GMT
Access-control-allow-origin: *
Content-type: application/vnd.orcid+xml: qs=5;charset=UTF-8
X-frame-options: DENY
請保存您的輸入代碼,下一節將需要它來更新項目!
保存您的放置代碼
放置代碼是引用特定項目的簡短數字代碼 ORCID 記錄。
當您將項目發佈到研究人員的記錄時,API 響應將包含該項目的放置代碼。 如果您需要讀取、更新或刪除該項目,您可以存儲放置代碼以供以後使用。
在上面的示例中,輸入代碼是該行末尾的 5 位數字: 位置:http://api.sandbox。orcid.org/v3.0/0000-0002-4456-8947/education 26971
如果您的回復有誤,請檢查您的 XML 標記中是否有拼寫錯誤,以及您是否正確輸入了所有其他詳細信息。 最輕微的打字錯誤可能會破壞一切!
在 https://sandbox 訪問沙盒記錄的公共視圖。orcid.org/[ORCID ID] 以查看您的新教育機構。
請注意,Source 顯示了添加從屬關係的 API 客戶端的名稱——這是幫助其他系統消費的關鍵元素 ORCID 數據決定這條信息是否具有權威性。