fields


URI

<dataset_uri>/fields[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

dataset

Child resources

field

Introduction

The fields resource lists all fields in a dataset.

Performing a GET request on fields resource can get field info list of a dataset. Performing a POST request can add a field to an empty dataset. Note: Only support for adding fields to an empty dataset since it's not safe to operate field in a non-empty dataset.

Attribute fields of the attribute table for a dataset are divided into two kinds: system field, and non-system field. System fields are created when creating a dataset, which can't be edited, and all its content can't be edited except SMUSERID. Non-system fields are the fields created by users and can be edited. Different kinds of datasets have different system fields, but all start with "SM". The table below shows the system fields of different datasets of a UDB file datasources.

dataset type system field
Point Dataset SMID,SMX,SMY,SMLIBTIL,SMUSERID,SMGEOMETRYSIZE
Line Dataset SMID,SMLENGTH,SMSDRIW,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID,SMTOPOERROR,SMGEOMETRYSIZE
Region Dataset SMID,SMSDRIW ,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID,SMARE,SMPERIMETER,SMGEOMETRYSIZE
Text Dataset SMID,SMSDRIW,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID ,SMGEOMETRYSIZE
CAD Dataset SMID,SMSDRIW,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID ,SMGEOTYPE,SMLIBTIL,SMGEOMETRYSIZE
3D Point Dataset SMID,SMX,SMY,SMZ,SMUSERID,SMGEOMETRYSIZE
3D Line Dataset SMID,SMLENGTH,SMSDRIW,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID,SMTOPOERROR,SMGEOMETRYSIZE
3D Region Dataset SMID,SMSDRIW ,SMSDRIN,SMSDRIE,SMSDRIS,SMUSERID,SMARE,SMPERIMETER,SMGEOMETRYSIZE

 

Supported methods

Supported output formats: RJSON, JSON, HTML, XML.

Resource Hierarchy

root data datasources.htm datasource.htm datasets.htm fields.htm dataset.htm

HTTP request methods

Perform an HTTP request with the following URI, here we take rjson as the output format to demonstrate, where supermapiserver indicates the server name, World is the datasource name, and Ocean is one of the dataset in World.

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/world/datasets/name/Ocean/fields.rjson

GET Request

Gets the field infos list. Each detailed field info includes the field name, field type, field alias, default value, whether or not allowed to be null , its maximum length, whether the length allowed to be zero, etc.

Request parameters

To perform a GET request on fields resource, put the following parameter in URL:

Field Type Description
returnAll boolean Whether to return the detailed infos of the fields. When false, only the collection of field's URL and the collection of field name will be returned. Default value is false.

 

Response structure

After performing a GET request on fields resource, the returned response body structure sees as follows:

Name Type Description
fieldNames List<String> Field name list.
childUriList List<String> The URI list.

 

Example 1

Execute a GET request on fields resource with URL: http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields.rjson to get the field info collection of the Ocean dataset in World datasource, the response in rjson format is as follows:

{

    "childUriList": [

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMID",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMSDRIW",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMSDRIN",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMSDRIE",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMSDRIS",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMUSERID",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMAREA",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMPERIMETER",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/SMGEOMETRYSIZE",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields/WRLD30_ID"

    ],

    "fieldNames": [

        "SMID",

        "SMSDRIW",

        "SMSDRIN",

        "SMSDRIE",

        "SMSDRIS",

        "SMUSERID",

        "SMAREA",

        "SMPERIMETER",

        "SMGEOMETRYSIZE",

        "WRLD30_ID"

    ]

}

Example 2

Execute a GET request on fields resource with URL: http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Ocean/fields.rjson?returnAll=true to get the field info collection of the Ocean dataset in World datasource, the response in rjson format is as follows:

[

    {

        "caption": "SmID",

        "defaultValue": "",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmID",

        "type": "INT32"

    },

    {

        "caption": "SmSdriW",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmSdriW",

        "type": "SINGLE"

    },

    {

        "caption": "SmSdriN",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmSdriN",

        "type": "SINGLE"

    },

    {

        "caption": "SmSdriE",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmSdriE",

        "type": "SINGLE"

    },

    {

        "caption": "SmSdriS",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmSdriS",

        "type": "SINGLE"

    },

    {

        "caption": "SmUserID",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": false,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmUserID",

        "type": "INT32"

    },

    {

        "caption": "SmArea",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 8,

        "name": "SmArea",

        "type": "DOUBLE"

    },

    {

        "caption": "SmPerimeter",

        "defaultValue": "0",

        "isRequired": true,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 8,

        "name": "SmPerimeter",

        "type": "DOUBLE"

    },

    {

        "caption": "SmGeometrySize",

        "defaultValue": "0",

        "isRequired": false,

        "isSystemField": true,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "SmGeometrySize",

        "type": "INT32"

    },

    {

        "caption": "WRLD30_ID",

        "defaultValue": "",

        "isRequired": false,

        "isSystemField": false,

        "isZeroLengthAllowed": true,

        "maxLength": 4,

        "name": "WRLD30_ID",

        "type": "INT32"

    }

]

POST request

Adds a field.

Request parameters

Perform a POST request on fields resource to add a new field into an empty dataset, you need to put the detailed infos of the field to be created in the request body. The needed parameters are as follows:

Name Type Description
name string Field name. Uniquely identifies a field.
caption string Field alias. Different fields can have the same field alias.
type FieldType Field type.
defaultValue string The default value of the field.
isRequired boolean Whether it is required. True represents a required field; while false represents a non-required field.
isSystemField boolean

Whether it is SuperMap system field. True represents the SuperMap system field.

The SuperMap system field is prefixed with SM, except the SMUserID.

isZeroLengthAllowed boolean Whether the length can be zero.
maxLength int The maximum length of the field.

Response structure

The structure of the response entity is as follows:

Name Type Description
succeed boolean Indicates whether the operation is successful.
newResourceID string New field resource ID.
newResourceLoaction string New field resource URI.
error HttpError An error message. If successful, the field will be absent.

Example usage

Since the Ocean dataset corresponding to the sample fields resource is not empty, therefore, the POST request cannot be executed successfully to add a new field. Assume that there is an empty dataset resource in the World datasource. The URI sees as follows:

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Restcreate.rjson

Then you can implement a POST request on the fields resource corresponding to the dataset (:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Restcreate/fields.rjson) to add a new field. Parameters in the POST request body see as follows:

{

    "isZeroLengthAllowed": "false",

    "maxLength": "0",

    "isRequired": "false",

    "name": "value",

    "caption": "one",

    "type": "INT32",

    "defaultValue": "null",

    "isSystemField": "false"

}

If successful, the response in rjson format is as follows:

{

    "newResourceID": "value",

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/RestCreate/fields/value.rjson",

    "succeed": true

}

HEAD request

Returns the same HTTP response header as the GET request, but no response entity, which can be used to retrieve the meta data contained in response message header without having to transmit the entire response content. Meta data information includes media type, character coding, compression coding, entity content length, etc.

HEAD request is used to determine whether the fields resource exists, or if the client has the authority to access it. By executing an HEAD request with a .<format> URI, you can quickly determine whether the fields resource supports the <format> representation.

 

See