Community:NDR/modifyAgent
From NSDLWiki
Contents[hide] |
NDR API Documentation
modifyAgent
Modify an existing Agent object (see ObjectTypes) in the NDR.
Request URL
- http://ndr.nsdl.org/api/modifyAgent/[handle]
- where [handle] is an NDR handle for an existing Agent object.
- Must be an HTTP POST request.
Arguments
- (the Agent object handle is at the end of the requestURL)
- inputXML (required) - while inputXML is required, no specific element is required for the modifyAgent 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
- [command] (optional) - see below.
- identifier (optional) - if this is provided, it will replace the previous identifier in the Agent object. The value should be a unique identifier for the Agent. The type attribute must be "URL", "HOST", or "OTHER" (upper case required); URL identifiers should be used whenever possible. The NDR will ensure that Agent objects have exactly one identifier.
- identifier (optional) - if this is provided, it will replace the previous identifier in the Agent object. The value should be a unique identifier for the Agent. The type attribute must be "URL", "HOST", or "OTHER" (upper case required); URL identifiers should be used whenever possible. The NDR will ensure that Agent objects have exactly one identifier.
- [command] (optional) - see below.
- Relationships
- [command] (strongly recommended, but optional) - best practice is to use only explicit "add" or "delete". The "replace" command will only succeed if the Agent object has less than two existing memberOf relationships. See below.
- memberOf (optional) - the handle of any Aggregator objects of which this Agent is a member.
- memberOf (optional) - the handle of any Aggregator objects of which this Agent is a member.
- [command] (strongly recommended, but optional) - best practice is to use only explicit "add" or "delete". The "replace" command will only succeed if the Agent object has less than two existing memberOf relationships. See below.
- Datastreams
- [command] (optional) - see below.
- (DC metadata) (optional) - if this is provided, it will replace the previous simple Dublin Core XML metadata in the Agent object. The metadata provided should describe the Agent as completely as possible including information such as description, title (e.g. "Cornell Lab of Ornithology"), subject. Metadata must be compliant with the XML schema provided by the Open Archives Initiative at http://www.openarchives.org/OAI/2.0/oai_dc.xsd. The dc and oai_dc namespaces must be indicated, as well as the schema location for oai_dc. See the example below. The NDR will ensure that Agent objects have exactly one DC datastream.
- [command] (optional) - see below.
- Properties
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 an Agent object to be modified. The previous Agent identifier and metadata will be replaced by the information provided, while the memberOf relationship will be added to the Agent object.
<?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"> <agent> <properties> <identifier type="URL">http://www.drscience.com/</identifier> </properties> <relationships> <add> <memberOf>2200/12345</memberOF> </add> </relationships> <data> <modify> <DC> <oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> <dc:title>Doctor Science</dc:title> <dc:description>"America's foremost authoritarian on the world around us. Or at least the world around him."</dc:description> <dc:publisher>Ducks Breath Mystery Theater</dc:publisher> <dc:subject>science</dc:subject> <dc:subject>technology</dc:subject> </oai_dc:dc> </DC> </modify> </data> </agent> </inputXML>
- See also AddAgent.
Response Fields
- handle - the externally resolvable identifier for the Agent object.
- handleURL - the permanent URL to an XML representation of the Agent 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>2006-04-10T18:07:53Z</responseTime> <requestURL>http://ndr.nsdl.org/api/modifyAgent/2200/20060410173455215T</requestURL> <resultData> <handle>2200/20060410173455215T</handle> <handleURL>http://ndr.nsdl.org/api/describe/2200/20060410173455215T</handleURL> </resultData> </NSDLDataRepository>
See also APIBasics for general information about API responses.