Community:NDR/findResource
From NSDLWiki
Contents[hide] |
findResource
finds the handles for Resource objects (see ObjectTypes) that match a given identifier. If the identifier is a URL, the URL will be normalized by the NDR prior to searching for a matching Resource object.
Request URL
- http://ndr.nsdl.org/api/findResource
- May be an HTTP GET or POST request.
Arguments
There are various forms of invoking this particular API call:
- Specifying a resource url as a parameter
Example: http://ndr.nsdl.org/api/findResource?url=http://www.needs.org
- Specifying a resource identifier and type as parameters
Example: http://ndr.nsdl.org/api/findResource?identifier=http://www.dlese.org&type=URL
- Note: currently (2006-12), the type is ignored, and set to "URL" if the identifier parses as a URL; otherwise, it is set to "OTHER". If you want to use this feature, we recommend you do a POST request with an inputXML parameter (see below).
- Specifying a resource handle as a parameter
Example: http://ndr.nsdl.org/api/findResource?handle=2200/NSDL_Collections_Resource
- Specifying a resource identifier and type in inputXML as a POST parameter
- Example inputXML:
<?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://www.needs.org/</identifier> </properties> </resource> </inputXML>
Response Fields
- handle - an externally resolvable identifier for the resource object.
- 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://ndr.nsdl.org/api/findResource</requestURL> <resultData> <handle>2200/18191098465</handle> <handleURL>http://ndr.nsdl.org/api/describe/2200/18191098465</handleURL> </resultData> </NSDLDataRepository>