Community:NDR/modifyResource

From NSDLWiki

Jump to: navigation, search

Contents

[hide]

modifyResource

Modify an existing Resource object (see ObjectTypes) in the NDR.

Request URL

http://ndr.nsdl.org/api/addResource/[handle]
where [handle] is an NDR handle for an existing Resource object.
Must be an HTTP POST request.

Arguments

(the Resource object handle is at the end of the requestURL)
  • inputXML (required) - while inputXML is required, no specific element is required for the modifyResource request. Only data desired to be added, deleted, or replaced should be included. The inputXML may lack or contain empty <properties>, <relationships> and/or <data> elements.

    • Properties
      • the NDR currently does not allow any changes to a Resource object's identifier property.

    • Relationships
      • [command] (strongly recommended, but optional) - best practice is to use only explicit "add" or "delete". The "replace" command will only succeed if the Resource object has less than two existing memberOf relationships. See below.
        • memberOf (optional) - the handle of any Aggregator objects of which this Resource is a member.


where [command] is one of:

  • add - add the contained properties, relationships or datastreams to the object.
  • delete - remove the contained properties, relationships or datastreams from the object.
  • modify (default) - if the contained properties, relationships or datastreams already exist in the object, replace them with what is contained here. If the contained properties, relationships or datastreams do NOT exist in the object, add them.


Below is example inputXML for a Resource object to be modified. Two memberOf relationships will be added between the Resource object and the indicated Aggregator objects, and one memberOf relationship will be removed.
<?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>
    </properties>
    <Relationships>
      <add>
        <memberOf>2200/200605091201667T</memberOf>
        <memberOf>2200/200603201203503T</memberOf>
      </add>
      <delete>
        <memberOf>2200/200603201207497T</memberOf>
      </delete>
    </Relationships>
  </resource>
</inputXML>
See also AddResource.

Response Fields

  • handle - the externally resolvable identifier for the Resource object.
  • handleURL - the 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://ndr.nsdl.org/api/modifyResource/2200/1819102015</requestURL>
  <resultData>
    <handle>2200/1819102015</handle>
    <handleURL>http://ndr.nsdl.org/api/describe/2200/1819102015</handleURL>
  </resultData>
</NSDLDataRepository>

API Links:

Personal tools