Community:NDR/addResource

From NSDLWiki

Jump to: navigation, search

Contents

[hide]

addResource

Create a Resource object (see ObjectTypes) in the NDR.

Request URL

http://repository.nsdl.org/addResource
Must be an HTTP POST request.

Arguments

  • inputXML (required) - contains information to a represent the resource in the NDR.

    • Properties
      • identifier (required) - a unique identifier for the resource. The type attribute currently must be "URL", "HOST", or "OTHER" (upper case required); URL identifiers should be used whenever possible.

    • Relationships
      • memberOf (optional) - the handle of any Aggregator objects of which this Resource is a member.


Below is example inputXML for a Resource object to be added to the NDR with a URL identifier and a single memberOf relationship. Note that the command is understood to be "add" (rather than "replace" or "delete") so the inputXML does not require a command as the first child of the <properties>, <relationships> or <data> elements.
<?xml version="1.0" encoding="UTF-8"?>
<inputXML xmlns="http://ns.nsdl.org/ndr/request_v1.00/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.nsdl.org/ndr/request_v1.00/ http://ns.nsdl.org/schemas/ndr/request_v1.00.xsd" schemaVersion="1.00.000">
  <resource>
    <properties>
      <identifier type="URL">http://stuffonmycat.com/</identifier>
    </properties>
    <relationships>
      <memberOf>2200/666</memberOf>
    </relationships>
  </resource>
</inputXML>

Response Fields

  • handle - an externally resolvable identifier for the new Resource object. All Resource objects receive a handle reference when created in the NDR.
  • handleURL - a permanent URL to an XML representation of the Resource object in the NDR.

Response Example

<?xml version="1.0" encoding="UTF-8"?>
<NSDLDataRepository schemaVersion="1.00.000" xmlns="http://ns.nsdl.org/ndr/response_v1.00/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.nsdl.org/ndr/response_v1.00/ http://ns.nsdl.org/schemas/ndr/response_v1.00.xsd">
  <responseTime>2005-10-26T18:42:05Z</responseTime>
  <requestURL>http://repository.nsdl.org/addResource</requestURL>
  <resultData>
    <handle>2200/200603200913483T</handle>
    <handleURL>http://repository.nsdl.org/describe/2200/200603200913483T</handleURL>
  </resultData>
</NSDLDataRepository>

API Links:

Personal tools