步 3 个(共 5 个)
3.写信给 ORCID 记录 (POST)
恭喜! 您已经设置好所有内容并正在收集 ID 和权限 - 现在是有趣的部分! 在本课中,您将学习如何将数据写入 ORCID 记录。
在本节中,我们将向您的 Sandbox 记录添加“教育”隶属关系。
在以下示例中,我们将 /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 created 消息的摘录示例。
... <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 响应将包含该项目的放置代码。 如果您需要读取、更新或删除该项目,您可以存储放置代码以供以后使用。
在上面的示例中,put 代码是此行末尾的 5 位数字: 位置:http://api.sandbox。orcid.org/v3.0/0000-0002-4456-8947/education 26971
如果您的回复有误,请检查您的 XML 标签中是否有拼写错误,以及您是否已正确输入所有其他详细信息。 最轻微的错字可以破坏一切!
在 https://sandbox 访问沙盒记录的公共视图。orcid.org/[ORCID ID] 以查看您的新教育机构。
请注意,Source 显示了添加从属关系的 API 客户端的名称——这是帮助其他系统消费的关键元素 ORCID 数据决定这条信息是否具有权威性。