URI

<v1_uri>/layouts[.<format>]

Supported methods

GET、POST、HEAD

Parent resource

v1

Introduction

layoutTemplates 资源是 Web 打印服务的布局模板信息列表,通过发送 GET 请求,可以获取所有可用的模板信息。

Supported methods:

  • GET:获取 Web 打印服务所有可用的模板信息。
  • POST:上传并动态加载一个布局模板。
  • HEAD:检查 layoutTemplates resource exists, or if there is permission to access layoutTemplates 资源。

Supported output formats:RJSON、JSON、HTML、XML。

GIS Services Resource Hierarchy

HTTP Request Methods

对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。

http://supermapiserver:8090/iserver/services/webprinting/rest/webprinting/v1/layouts.rjson

GET 请求

获取 Web 打印服务所有可用的模板列表信息。

Response structure

对 layoutTemplates 资源执行 GET 请求,在响应体里是一个布局模板信息的描述集,其中单个布局模板描述的结构如下:

字段 类型 说明
templateName String 布局模板文件夹的名称。
webMapFrameSize array 主地图 WebMap 图框的像素大小,如:[632,428]。
maxDPI number 主地图的最大打印 DPI。
suggestionDpis array 主地图建议的一组DPI。
layoutOptions object Web 打印的布局选项。

layoutOptions 对象的结构如下:

字段 类型 说明
hasTitle boolean 是否有地图主标题名称。
hasSubTitle boolean 是否有地图副标题名称。
hasAuthor boolean 是否有地图作者信息。
hasCopyright boolean 是否有地图版权信息。
hasLittleMap boolean 是否有小地图。
haslegend boolean 是否有图例。
hasScaleBar boolean 是否有比例尺条。
hasNorthArrow boolean 是否有指北针。

Example of response

对 layoutTemplates 资源:http://supermapiserver:8090/iserver/services/webprinting/rest/webprinting/v1/layouts.rjson,执行 GET 请求,返回 rjson 格式的资源描述如下:

[

    {

        "templateName": "string",

        "webMapFrameSize": [

            0

        ],

        "maxDPI": 0,

        "suggestionDpis": [

            0

        ],

        "layoutOptions": {

            "hasTitle": true,

            "hasAuthor": true,

            "hasCopyright": true,

            "hasSubTitle": true,

            "hasLittleMap": true,

            "hasLegend": true,

            "hasScaleBar": true,

            "hasNorthArrow": true,

        }

    }

]

POST 请求

上传并动态加载一个布局模板。(暂未实现)

Request parameters

请求体中需传递布局模板文件流。

Response structure

Normal response code(s): 201. The response parameters are as follows:

字段 类型 说明
successed boolean 上传并动态加载一个布局模板是否成功。
errorMsg String 出错信息。

Example of response

对 layoutTemplates 资源:http://supermapiserver:8090/iserver/services/webprinting/rest/webprinting/v1/layouts.rjson,执行 POST 请求,传递一个布局模板文件流,返回的 rjson 格式的资源描述如下:

{

    "successed": true

}

HEAD 请求

Returns the same HTTP response headers as a GET request, but without the response body. This allows retrieving meta-information from the response headers without transporting the entire content. The meta-information includes the media type,字符编码,压缩编码,实体内容长度等。

A HEAD request can be used to check if layoutTemplates 资源是否存在,或者客户端是否有权限访问 layoutTemplates 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 layoutTemplates 资源是否支持<format>格式的表述。

See