Preview
Hi, Visitor  | 

List shapefiles with the ShapeServer REST API

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Use the following URL templates to list the shapefiles that are accessible by you. Publicly-accessible shapefiles are also included if your subscription plan includes them. The response contains the metadata of the shapefiles also.

Supported HTTP Methods

GET

URL Templates

List all files, including their metadata, which are accessible by me
http://api.shapeserver.com/REST/v1/shapefiles/inventory?format=format&publicShapes=publicShapes&key=ShapeServerKey
Get metadata of a single shapefile
http://api.shapeserver.com/REST/v1/shapefiles/inventory?file=filename&format=format&key=ShapeServerKey

Template Parameters

Note
Parameter names and values are not case-sensitive.
Parameter Description Values
file Optional The name of the shapefile for which to retrieve metadata. A string with the shapefile name. Omit this parameter to retrieve a list of all files and their metadata.
Example: file=RiverSample
publicShapes Optional Indicates whether to include publicly-accessible shapefiles in the result list. Valid only when parameter 'file' is omitted.
Note
Publicly-accessible shapefiles are included only if your subscription plan includes them.
A string that contains an integer value of 0 or 1. The default value is 0.
Example: publicShapes=1
format Optional The output format for the response. One of the following values:
  • xml [default]
  • json
Example: format=json
key Required Specifies the ShapeServer key to use for this request. A valid ShapeServer key.
Example: key=abc1234def56789

Input

When you create the HTTP request, you must set the content type in the request to the following value:
  • XML (application/xml)

Response

A Response resource is returned when you make a request. The response supports the following response formats:
  • XML (application/xml)
  • JSON (application/json)

Examples

List all files and their metadata which are accessible by me
The following example queries ShapeServer to return all files which are accessible by me and includes their metadata.
http://api.shapeserver.com/REST/v1/shapefiles/inventory?key=ShapeServerKey

XML Response

                    
<Response xmlns="http://schemas.shapeserver.com/rest/v1" 
		  xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Copyright>Copyright © 2011-2012 BartelsOnline. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from BartelsOnline.</Copyright>
	<StatusCode>200</StatusCode>
	<StatusDescription>OK</StatusDescription>
	<ErrorDetails/>
	<TraceId>A194389081078C7D09BEBEABD04A01E877624938/3318f356-d4a5-4df6-b46b-42baf617454f/1150718115</TraceId>
	<Resource i:type="ShapefileMetaDataCollection">
		<ItemId>1</ItemId>
		<FileCount>2</FileCount>
		<Shapefiles>
			<ShapefileMetaData>
				<Name>countries</Name>
				<Created>2012-11-28T11:43:42.293</Created>
				<Modified>2012-11-28T10:43:44.68</Modified>
				<SRID>4326</SRID>
				<ShapeType>Polygon</ShapeType>
				<FeatureCount>147</FeatureCount>
				<BoundingBox>Lower Left: (-180,00, -89,90) Upper Right: (180,00, 83,60)</BoundingBox>
				<CoordinateSystem>GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]]</CoordinateSystem>
				<IsPublicShape>true</IsPublicShape>
				<Description/>
				<Comments/>
				<Tags/>
			</ShapefileMetaData>
			<ShapefileMetaData>
				<Name>cities</Name>
				<Created>2012-11-16T11:33:41.313</Created>
				<Modified>2012-11-16T10:33:42.107</Modified>
				<SRID>4326</SRID>
				<ShapeType>Point</ShapeType>
				<FeatureCount>478</FeatureCount>
				<BoundingBox>Lower Left: (-157,81, -43,55) Upper Right: (175,14, 68,96)</BoundingBox>
				<CoordinateSystem>GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]]</CoordinateSystem>
				<IsPublicShape>true</IsPublicShape>
				<Description/>
				<Comments/>
				<Tags/>
			</ShapefileMetaData>
		</Shapefiles>
	</Resource>
</Response>
                

JSON Response

                    
{
	"Copyright":"Copyright © 2011-2012 BartelsOnline. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from BartelsOnline.",
	"StatusCode":200,
	"StatusDescription":"OK",
	"ErrorDetails":"",
	"TraceId":"A194389081078C7D09BEBEABD04A01E877624938\/306c69e3-e8d2-42b5-8b30-d3dab9da8346\/-1604687266",
	"Resource":
	{
		"__type":"ShapefileMetaDataCollection:http:\/\/schemas.shapeserver.com\/rest\/v1",
		"ItemId":1,
		"FileCount":2,
		"Shapefiles":
		[
			{
				"Name":"countries",
				"Created":"\/Date(1354099422293+0100)\/",
				"Modified":"\/Date(1354095824680+0100)\/",
				"SRID":4326,
				"ShapeType":"Polygon",
				"FeatureCount":147,
				"BoundingBox":"Lower Left: (-180,00, -89,90) Upper Right: (180,00, 83,60)",
				"CoordinateSystem":"GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\", 6378137, 298.257223563]], PRIMEM[\"Greenwich\", 0], UNIT[\"Degree\", 0.0174532925199433]]",
				"IsPublicShape":true,
				"Description":"",
				"Comments":"",
				"Tags":""
			},
			{
				"Name":"cities",
				"Created":"\/Date(1353062021313+0100)\/",
				"Modified":"\/Date(1353058422107+0100)\/",
				"SRID":4326,
				"ShapeType":"Point",
				"FeatureCount":478,
				"BoundingBox":"Lower Left: (-157,81, -43,55) Upper Right: (175,14, 68,96)",
				"CoordinateSystem":"GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\", 6378137, 298.257223563]], PRIMEM[\"Greenwich\", 0], UNIT[\"Degree\", 0.0174532925199433]]",
				"IsPublicShape":true,
				"Description":"",
				"Comments":"",
				"Tags":""
			}
		]
	}
}
                
Get metadata of a single shapefile
The following example queries ShapeServer to return the metadata of file 'cities'.
http://api.shapeserver.com/REST/v1/shapefiles/inventory?file=cities&key=ShapeServerKey

XML Response

                    
<Response xmlns="http://schemas.shapeserver.com/rest/v1" 
		  xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Copyright>Copyright © 2011-2012 BartelsOnline. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from BartelsOnline.</Copyright>
	<StatusCode>200</StatusCode>
	<StatusDescription>OK</StatusDescription>
	<ErrorDetails/>
	<TraceId>A194389081078C7D09BEBEABD04A01E877624938/14f4c2d8-2e0f-4ecb-8951-b3ba530eff25/128174802</TraceId>
	<Resource i:type="ShapefileMetaDataCollection">
		<ItemId>1</ItemId>
		<FileCount>1</FileCount>
		<Shapefiles>
			<ShapefileMetaData>
				<Name>cities</Name>
				<Created>2012-11-16T11:33:41.313</Created>
				<Modified>2012-11-16T10:33:42.107</Modified>
				<SRID>4326</SRID>
				<ShapeType>Point</ShapeType>
				<FeatureCount>478</FeatureCount>
				<BoundingBox>Lower Left: (-157,81, -43,55) Upper Right: (175,14, 68,96)</BoundingBox>
				<CoordinateSystem>GEOGCS["GCS_WGS_1984", DATUM["D_WGS_1984", SPHEROID["WGS_1984", 6378137, 298.257223563]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]]</CoordinateSystem>
				<IsPublicShape>true</IsPublicShape>
				<Description/>
				<Comments/>
				<Tags/>
			</ShapefileMetaData>
		</Shapefiles>
	</Resource>
</Response>
                

JSON Response

                    
{
	"Copyright":"Copyright © 2011-2012 BartelsOnline. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from BartelsOnline.",
	"StatusCode":200,
	"StatusDescription":"OK",
	"ErrorDetails":"",
	"TraceId":"A194389081078C7D09BEBEABD04A01E877624938\/7f62de89-0cbe-4f07-9c3b-fa630106efd0\/-491299305",
	"Resource":
	{
		"__type":"ShapefileMetaDataCollection:http:\/\/schemas.shapeserver.com\/rest\/v1",
		"ItemId":1,
		"FileCount":1,
		"Shapefiles":
		[
			{
				"Name":"cities",
				"Created":"\/Date(1353062021313+0100)\/",
				"Modified":"\/Date(1353058422107+0100)\/",
				"SRID":4326,
				"ShapeType":"Point",
				"FeatureCount":478,
				"BoundingBox":"Lower Left: (-157,81, -43,55) Upper Right: (175,14, 68,96)",
				"CoordinateSystem":"GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\", 6378137, 298.257223563]], PRIMEM[\"Greenwich\", 0], UNIT[\"Degree\", 0.0174532925199433]]",
				"IsPublicShape":true,
				"Description":"",
				"Comments":"",
				"Tags":""
			}
		]
	}
}
                

HTTP Status Codes

When the request is successful, the following HTTP status code is returned.
  • 200
When the request is not successful, the response returns one of the following errors.
  • 400
  • 401
  • 404
  • 500
  • 503

See Also