GetRecords Request |
GetRecords operation obeys HTTP protocol. The client uses KVP encoding format to send request. The main request parameters are shown as follows:
Table 1 Main Parameters of GetRecords Operation Request
Request Parameters | O/M | Description |
SERVICE=CSW |
Mandatory |
Service type. Request CSW service,the request type should be set as CSW. |
REQUEST=GetRecords |
Mandatory |
Name of the request operation. Request GetRecords operation, the request name should be set as "GetRecords". |
VERSION=version |
Mandatory |
Supported version. he service version should be set as "2.0.2". |
NAMESPACE=nameSpace |
Optional |
Specified NameSpace address. |
RESULTTYPE=resultType |
Optional |
Type of the request result. The values are results, hits and validate. Results and hits type are supported currently. |
REQUESTID=requestid |
Optional |
Include the unique identifier of request information. |
OUTPUTFORMAT=outputFormat |
Optional |
Output format. Used to control the output format. The default is application/xml. |
OUTPUTSCHEMA=outputSchema |
Optional |
The result structure and format The default value is http://www.opengis.net/cat/csw/2.0.2. |
STARTPOSITION=startPosition |
Optional |
Specify the start position of the returned result. The default value is 1, which means return results to client from the first record. |
MAXRECORDS=maxRecords |
Optional |
The maximum number of records. Specify the max number of records in return results. If the number of records satisfying the query conditions is less than this value, return all the satisfying records. |
TYPENAMES=typeNames |
Mandatory |
Query information model object. For example, Record model of csw ogc. |
ELEMENTSETNAME=ElementSetName |
Optional |
The returned result type. The value could be brief, summary or full. |
ELEMENTNAME=ElementName |
Optional |
Return results according to specified fields. For example, <dc:modified> |
CONSTRAINTLANGUAGE=ConstranintLanguage |
Optional |
Specify query predicate language. For example, ogc: filter1.1.0. |
CONSTRAINT=Constraint |
Optional |
Constraint condition. Used to define the query predicate expression. The default is to return all results. For example, query the intersection records of the defined area from all records. <Constraint version="1.1.0"> <ogc:Filter> <ogc:Within> <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName> <gml:Envelope> <gml:lowerCorner>-181 -91</gml:lowerCorner> <gml:upperCorner>181 91</gml:upperCorner> </gml:Envelope> </ogc:Within> </ogc:Filter> </Constraint> |
SORTBY=SortBy |
Optional |
Sort the specified field of query data. For example: <SortBy sortOrder='ASC'>modified</SortBy> |
Post request method of GetRecords operation is shown as follows:
GetRecords operation obeys HTTP protocol. The client uses POST method to send request. For example, after the local SuperMap iServer CSW 2.0.2 service is started successfully, the URI of accessing the Execute operation is: http://localhost:8090/iserver/services.csw?SERVICE=CSW&REQUEST=GetRecords&VERSION=2.0.2.
Query metadata records intersecting with a defined range and whose title field contains "map-world" character. The request body is shown as follows:
<?xml version="1.0" encoding="utf-8"?>
<GetRecords service="CSW" version="2.0.2" maxRecords="5" startPosition="1" resultType="results" outputFormat="application/xml" outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<ResponseHandler>ftp://www.myserver.com/pub/MyQuery_Resp.xml</ResponseHandler>
<Query typeNames="Record">
<ElementSetName>SUMMARY</ElementSetName>
<Constraint version="1.1.0">
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsLike wildCard="%" singleChar="_" escapeChar="\">
<ogc:PropertyName>title</ogc:PropertyName>
<ogc:Literal>%map-world%</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:Intersects>
<ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
<gml:Envelope>
<gml:lowerCorner>14.05 46.46</gml:lowerCorner>
<gml:upperCorner>17.24 48.42</gml:upperCorner>
</gml:Envelope>
</ogc:Intersects>
</ogc:And>
</ogc:Filter>
</Constraint>
</Query>
</GetRecords>
Please refer to Response Sample.
Query the metadata records in a given time range. The request body is shown as follows:
<?xml version="1.0" encoding="utf-8"?>
<GetRecords service="CSW" version="2.0.2" maxRecords="5" startPosition="1" resultType="results" outputFormat="application/xml" outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd"> <ResponseHandler>ftp://www.myserver.com/pub/MyQuery_Resp.xml</ResponseHandler>
<Query typeNames="Record">
<ElementSetName>brief</ElementSetName>
<Constraint version="1.1.0">
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>modified</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>2012-09-01</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>2020-09-22</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
</Constraint>
</Query>
</GetRecords>
Query metadata records of rest type. The request body is shown as follows:
<?xml version="1.0" encoding="utf-8"?>
<GetRecords service="CSW" version="2.0.2" maxRecords="5"
startPosition="1" resultType="results" outputFormat="application/xml"
outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns="http://www.opengis.net/cat/csw/2.0.2"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<ResponseHandler>ftp://www.myserver.com/pub/MyQuery_Resp.xml</ResponseHandler>
<Query typeNames="Record">
<ElementSetName>brief</ElementSetName>
<Constraint version="1.1.0">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>dc:type</ogc:PropertyName>
<ogc:Literal>rest</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</Constraint>
</Query>
</GetRecords>