https://docs.geoserver.org/stable/en/user/rest/
Geoserver的rest接口使用(后台或者前端调实现自动发布服务):
ArcGIS_REST_API常用参数简要说明:https://wenku.baidu.com/view/2846c53e580216fc700afdc9.html#
Introduction
The ArcGIS REST API allows you to administer ArcGIS Server programmatically. This means that you can completely manage your server using any framework that can make HTTP requests.
ArcGIS REST API允许您以编程的方式管理ArcGIS服务器。这意味着您可以使用任何可以发出HTTP请求的框架来完全管理服务器。
The API is organized into resources and operations. Resources are entities within ArcGIS Server that hold some information and have a well-defined state. Operations act on these resources and update their information or state. Resources and operations are hierarchical and have unique universal resource locators (URLs).
API分为资源和操作两部分。资源是ArcGIS服务器中保存一些信息并且具有定义良好的状态的实体。操作可以对这些资源进行操作并更新其信息或状态。资源和操作是分层的,并且具有唯一的通用资源定位器(url)。
This topic is designed to help you navigate through the APIs as well as be more productive in administering ArcGIS Server.
本主题旨在帮助您在api中导航,并提高管理ArcGIS Server的效率。
Getting started开始
The hierarchical root of the Administrator API begins with a well-defined URL called as the site URL. Typically, this is accessible at:
管理者API的层次根以一个定义好的URL开始,它叫站URL。通常,可以在以下位置访问:
https://myserver.mydomain:6443/arcgis/admin
Organized hierarchically from the site URL are the various resources and operations that are exposed by the Administrator API. To access a resource or invoke an operation, you must create a request by doing the following:
在站点URL中按层次结构组织的是由Administrator api公开的各种资源和操作。要访问一个资源或调用一个操作,必须通过执行以下操作来创建请求:
- Constructing a URL to the selected resource or operation as defined in the API Reference 构造一个URL,指向选中的资源或操作,这些资源或操作是在API Reference中定义好的。
- Providing the relevant parameters in their specified format 提供相关参数,要按照指定的格式提供。
- Accessing the URL over the prescribed HTTP method (typically GET or POST) 通过指定的HTTP方法访问URL(通常是GET或POST)
The API is stateless, which means that the server does not keep track of transactions from one request to the next. Each request must contain all the information necessary for successful processing. The server will process each request and return a well-defined response.
API是无状态的,这意味着服务器不会跟踪事务从一个请求到下一个请求。每个请求必须包含所有必须的信息才能成功完成处理。服务器将会处理每一个请求并返回一个定义好的响应。
For more information, see the API Reference section of this document.
有关更多信息,请参阅本文档的API Reference部分。
Administrator Directory管理员目录
The Administrator Directory, which is installed with each instance of ArcGIS Server, is a simple HTML interface that allows you to interact with the resources and operations exposed by the Administrator API. This can be helpful when building scripts for administrative tasks and applications. To access the Administrator Directory, browse to the site URL in a web browser.
管理员目录,是一个简单的HTML接口,允许您与Administrator API公开的资源和操作进行交互,它是随ArcGIS Server的每个实例一起安装的。这在为管理任务和应用程序创建脚本时非常有用。要访问管理员目录,请在web浏览器中浏览到站点URL。
资源:machines clusters services security system data uploads logs kml info publicKey
支持的操作:generateToken exportSite importSite deleteSite
支持的接口:REST
Resource hierarchy资源目录
This resource hierarchy demonstrates how resources and operations are related to one another in the server administration portion of the ArcGIS REST API.
参考:https://developers.arcgis.com/rest/enterprise-administration/server/resource-hierarchy.htm 企业管理员REST服务
https://developers.arcgis.com/rest/services-reference/gp-service.htm ArcGIS REST服务
https://developers.arcgis.com/rest/
https://developers.arcgis.com/labs/rest/search-for-an-address/
REST Update Features
ArcGIS REST API
Get started开始
To successfully use the ArcGIS REST API, you must understand how to construct a URL and interpret the response. All resources and operations exposed by the ArcGIS Services portion of the REST API are accessible through a hierarchy of endpoints for each GIS service published with ArcGIS Server.
要成功地使用ArcGIS REST API,你必须了解如何构造一个URL并且解析对应的响应。REST API的ArcGIS Services部分公开的所有的资源和操作都可以通过ArcGIS服务器发布的每个GIS服务的断点层次结构进行访问。
Determine the well-known endpoint确定已知端点
When using the REST API, you must know the well-known endpoint, which represents a server catalog.
使用restapi时,必须知道已知的端点,它表示服务器目录。
For ArcGIS Server, the default endpoint is as follows:
对ArcGIS Server来说,默认的端点如下所示:
https://<host>/<site>/rest/services/<folder>/<serviceName>/<serviceType>
Where:
- https://<host> is the ArcGIS Server host name.
- /<site> is the site name. The default value is "/arcgis/". ArcGIS Server accepts a site name specified in a URL as lowercase (arcgis) or camel case (ArcGIS). Using an all lowercase site name is recommended./site是站点名字。默认值为/arcgis/。ArcGIS Server接受URL中的站点名称为小写字母或驼峰格式的形式。推荐使用全小写形式的站点名字。
- rest/services indicates the REST services endpoint. You'll see a list of all services in the root directory along with any folders. This part of the URL is case sensitive and should be specified in all lowercase. rest/services表示端点服务。您将看到根目录中所有服务的列表以及所有文件夹。URL的这一部分区分大小写,应全部以小写形式指定。
- /<serviceName>/<serviceType> represents the name of the service and its type (for example, PopulationDensity/MapServer). The service name is case sensitive and should be specified in the case in which it was created. The service type should always be specified in a mixed case format as defined for each service in the REST API reference (for example, MapServer, GeocodeServer, and GPServer)./<serviceName>/<serviceType>表示服务的名字和类型(例如,PopulationDensity/MapServer)。服务名称区分大小写,应在创建服务名称的情况下指定。服务类型应始终以混合大小写格式指定,如restapi引用中为每个服务定义的(例如,MapServer、GeocodeServer和GPServer)。
For example, to get to the root directory of Sample Server 1 on ArcGIS Online services, the URL is as follows:
例如,要进入ArcGIS Online的Sample Server 1的根目录,URL如下所示:
https://sampleserver1.arcgisonline.com/arcgis/rest/services
Browse using the Services Directory使用服务目录浏览
When you type a URL endpoint in your browser, you'll see the Services Directory. Each ArcGIS Server site comes with a Services Directory, which provides a way for you to browse the list of services, folders, and operations on a server. 在浏览器中键入URL端点时,将看到Services目录。每个ArcGIS服务器站点都附带一个服务目录,它为您提供了一种浏览服务器上的服务、文件夹和操作列表的方法。
- If you're unfamiliar with the Services Directory, see the Using the Services Directory.如果您不熟悉服务目录,请参阅使用服务目录。
- Browse through the folders and services on Sample Server 1 to see how the URL changes as you browse to different pages. Note that the folder and service names in the URLs are case sensitive. •浏览示例服务器1上的文件夹和服务,以查看在浏览不同页面时URL的变化情况。请注意,URL中的文件夹和服务名称区分大小写。
Understand the documentation理解文档
The REST API documentation has topics on all resources and operations as well as some introductory and reference topics. The hierarchy of resources and operations listed in the table of contents matches the hierarchy of the API. Each topic contains a description, URL parameters and examples, and JSON object response examples and explanations. restapi文档有关于所有资源和操作的主题,以及一些介绍性和参考性的主题。目录中列出的资源和操作的层次结构与API的层次结构相匹配。每个主题都包含一个描述、URL参数和示例,以及JSON对象响应示例和解释。
- The top node is Catalog.顶部节点是Catalog。
- Under Catalog, are the service types, such as Map Service and Geocode Service.Catalog下面,是服务类型,例如Map Service和Geocode Service。
- Under the service types, are the operations and child resources associated with a service type. For example, a map service has Export Map and Identify operations, among others. There is also a Map Tilechild resource.在服务类型下面,是与服务类型相关联的操作和子资源。例如,地图服务具有导出地图(Export Map)和标识(Identify)操作,和其他的操作等。还有一个地图切片(Map Tile)子资源。
Create a URL and see the response创建一个URL并查看响应
When using the REST API, you need to construct URLs. The Services Directory can help you generate URLs that include the reference to a resource as well as any parameters. A URL with parameters will have the following syntax:当使用REST API时,你需要构造URL。服务目录能帮助你生成URL,URL包含对资源的引用,除了参数。一个带参数的URL将具有以下语法:
https://<resource-url>/<operation>?<parameter1=value1>&<parameter2=value2>
Where:其中:
- https://<resource-url> is the URL to a given resource. If the resource is a server object extension or a geoprocessing service task, the resource name is case sensitive.https://<resource-url>是一个给定资源的URL。如果资源是一个服务器对象扩展或者是一个地理处理服务任务,那么资源名是大小写敏感的。
- <Operation> represents the name of an operation supported on a resource. The operation name is not case sensitive, but it's recommended that you use the operation name as specified in the REST API.<Operation>代表这个资源支持的一个操作的名字。操作名不是大小写敏感的,但是建议你使用REST API指定的操作名。
- ? denotes the beginning of a parameter list.问号?表示参数列的开始。
- parameter1=value1 is a name-value pair. The parameter values are case sensitive if the value is JSON or enumeration.parameter1=value1是键值对。参数值是大小写敏感的,如果值是JSON或者枚举类型的话。
Almost all resources have an f parameter. This parameter determines the output format. For more information, see Output formats.
几乎所有资源都有一个f参数。此参数确定输出格式。有关详细信息,请参见输出格式。
To retrieve information about a map service in a JSON object, you would use a URL similar to the following:
如果在JSON中检索关于地图的信息,你可以使用类似于如下格式的URL:
The JSON response looks similar to the following:返回的JSON看上去类似于如下:
In another example, you can request to export a map. In this case, you would use the map service export operation. For this operation, you need to include the bbox parameter. Some parameters are optional and some are required. These requirements are noted in the documentation. An example URL is as follows:在另一个例子中,你可以请求导出地图。在本例子,您将使用地图服务导出操作。对于此操作,需要包含bbox参数。有些参数是可选的,有些是必需的。文档中注明了这些要求。示例URL如下所示:
The above URL returns the response in HTML format, and you see an image along with its width, height, extent, and scale. If you want the same information returned in a JSON object, you need to include the fparameter:上面的URL以HTML格式返回响应,您将看到一个图像及其宽度、高度、范围和比例。如果你希望以JSON对象返回,你需要包含f参数:
https://myserver/arcgis/rest/services/maps/world/MapServer/export?bbox=-197.99999664046,-131.792384313038,197.99999664046,125.388423131397&f=json
The response looks similar to the following:返回的响应应该类似于如下所示:
{"href":"https://sampleserver1.arcgisonline.com/arcgisoutput/_ags_map77043d465f5547f09c5b.png", "width":400,"height":400,"extent":{"xmin":-195.85,"ymin":-28.8,"xmax":-48.95,"ymax":118.1,"spatialReference":{"wkid":4269}}, "scale":154341679.023927}
If you want the JSON object response to be more readable, you can use pjson. This option should only be used for debugging purposes, since it takes longer to process the response.如果希望返回的JSON对象更具可读性,可以使用psjon。这个选项应该只用于调试目的,因为它需要更长时间来处理响应。
{
"href" : "https://sampleserver1.arcgisonline.com/arcgisoutput/_ags_mape8e1ca53a24a477380c7c9940e7b073d.png",
"width" : 400,
"height" : 400,
"extent" : {
"xmin" : -195.85,
"ymin" : -28.8,
"xmax" : -48.95,
"ymax" : 118.1,
"spatialReference" : {
"wkid" : 4269
}
},
"scale" : 154341679.023927
}
Use the Services Directory dialog boxes to generate parameter values in the URL使用Services Directory对话框生成URL中参数值
The Services Directory includes dialog boxes for all valid operations with a resource. These dialog boxes allow you to input values for URL parameters for testing purposes. The response includes the results and an encoded URL.Services Directory(服务目录)包含所有与资源相关的有效操作的对话框。这些对话框允许你输入用于测试的URL参数值。响应包括结果和编码的URL。
As an example, view the find dialog box for a USA service on sampleserver1:例如,查看sampleserver1上的USA服务的“查找”对话框:
When you provide this URL or browse to this URL in the Services Directory, you'll see the following dialog box: 当您在Services目录中提供此URL或浏览到此URL时,您将看到以下对话框:
Each field in the dialog box is one of the URL parameters for the find operation. The Find topic contains example values that are valid for each parameter. In the following example, a find operation is made on a states layer in the USA map service. The search text is New York. Only layer 1 (states) is searched, and the return geometry is requested. The find results are returned in HTML format. 对话框中的每个字段都是find操作的URL参数之一。Find主题包含对每个参数有效的示例值。在下面的示例中,在美国地图服务的states图层上执行查找操作。搜索文本是纽约。只搜索图层1(状态),并请求返回几何图形。查找结果以HTML格式返回。
Notice the URL that was generated. The values you entered in the dialog box are shown as parameters in the URL.注意生成的参数。在对话框中输入的值在URL中显示为参数。
https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/find?searchText=New+York&contains=true&searchFields=&sr=&layers=1&layerdefs=&returnGeometry=true&maxAllowableOffset=&f=HTML
Many characters in the request must be encoded in the URL. Encoding replaces certain special characters with hexadecimal values. The Services Directory (being a browser-based application) encodes URLs, but you need to do your own encoding in your application. The following example shows a URL where many spaces, commas, curly brackets, colons, and other characters have been encoded:请求的许多字符必须在URL中编码。编码用十六进制值替换某些特殊字符。Services目录(作为一个基于浏览器的应用程序)对URL进行编码,但是您需要在你的应用中自己进行编码。如下的示例显示了一个URL,其中对许多空格、逗号、花括号、冒号和其他字符进行了编码:
https://myserver/arcgis/rest/services/maps/world/MapServer/identify?geometryType=esriGeometryPoint&geometry=%7Bx%3A+-104%2C+y%3A+35.6%7D&sr=&layers=&tolerance=&mapExtent=-104%2C35.6%2C-94.32%2C41&imageDisplay=600%2C400%2C96&returnGeometry=true
Note that unless otherwise stated, the URL examples in the REST API documentation are shown in their unencoded form for better readability. 注意,除非另有说明,restapi文档中的URL示例以未编码的形式显示,以提高可读性。