REST API Reference > Data Integration REST API > Fields
  

Fields

A field is a subset of a data structure that represents a single data item. For example, a database table column is a field. You can request and update field details for a source or target object.

Getting field details

Use the fields resource to get field details for a source or target object.

GET request

To get field details for a source object, use one of the following URIs:
To get field details for a target object, use one of the following URIs:
You can use the following URI if the object name includes a forward slash (/):
/api/v2/connection/<source or target>/<id>/fields?objectName=<objectName>
If you use the connection name in the URI and the connection name includes a space, replace the space with %20. For example:
/api/v2/connection/source/name/my%20connection/field/customer
Note: The object name is case-sensitive.

GET response

The response returns the field object for each field in the source or target object and an error object if an error occurs.
The following table describes the attributes in the field object that might be returned based on the connection type:
Field
Type
Description
id
Long
Field ID.
name
String
Field name.
type
String
Field type.
label
String
Field label.
parentObject
String
Parent object, if applicable.
precision
Int
Length of the field in bytes.
pcType
String
PowerCenter data type.
scale
Int
Number of digits after the decimal point for numeric values.
columnIndex
Int
Column index.
isKey
Boolean
Whether the field is a used as a key.
isExternalId
Boolean
Whether the field is used as an external ID.
isSfldLookup
Boolean
Whether the field is used as a Salesforce ID lookup field.
isNullible
Boolean
Whether the field can contain null values.
isUnique
Boolean
Whether the field requires unique values.
isCreateable
Boolean
Whether the field accepts new values.
isCalculated
Boolean
Whether the field is calculated.
isUpdateable
Boolean
Whether the field allows updates.
isFilterable
Boolean
Whether the field can be filtered.
linkedFields
String
For a masking task, the source field mapped to the input field of the mapplet.
relatedInfos
Information about related fields included in a fieldRelatedInfo object for each related field.
fieldId
Long
Included in the fieldRelatedInfo object.
Field ID.
referenceObject
String
Included in the fieldRelatedInfo object. Object that includes the field.
relationshipName
String
Included in the fieldRelatedInfo object. Relationship to object.
references
Reference information included in a fieldRelatedInfo object for each related field.
fieldId
Long
Included in the fieldRelatedInfo object.
Field ID.
referenceObject
String
Included in the fieldRelatedInfo object.
Object that includes the field.
relationshipName
String
Included in the fieldRelatedInfo object.
Relationship to object.
javaType
String
Java data type.
showLabel
Boolean
Whether to show the field label.
naturalOrder
Int
Position number of the field in the source.
customProperties
Custom properties for the field.

GET example

To get field details for a Customer source object available through the source connection with ID 0002D420000000J, you might use the following request:
GET <serverUrl>/api/v2/connection/source/0002D420000000J/field/Customer
Content-Type: application/xml
Accept: application/xml
icSessionId: <icSessionId>
A successful request returns the fields object for each field in the Customer source object.

Updating fields in flat files

Use the fields resource to update fields in a source or target object from a flat file connection.

POST request

Use one of the following URIs:
When you update the fields in the object, the flat file attributes in the request override the default attributes for the object.
The following table describes the attributes you can include in the flatFileAttrs object that you specify in the request:
Field
Type
Required
Description
id
Long
Yes
Field ID.
delimiter
String
Yes
Character used to separate fields.
textQualifier
String
Yes
Quote character that defines the boundaries of text strings.
escapeChar
String
Yes
Character immediately preceding a field delimiter character embedded in an unquoted string, or immediately preceding the quote character in a quoted string.
headerLineNo
Int
Yes
Number of header lines.
firstDataRow
Int
Yes
The row number where the data begins in the file.
rowDelimiter
Int
--
Line break character. Enter the decimal code for an ASCII character between 1 and 32.
Default is 10, which is the line feed character.
consecutiveDelimiter
Boolean
--
Indicates whether one or more consecutive delimiters are treated as one.
Default is false.
multiDelimitersAsAnd
Boolean
--
If the delimiter you specify is more than one character, indicates whether the characters are treated as a single delimiter or multiple delimiters.
Default is true.

POST request example

To update fields in a flat file source object, you might use the following request:
POST <serverUrl>/api/v2/connection/source/0000010B000000000021/field/test_precision.csv
1.0
Content-Type: application/xml
Accept: application/xml
icSessionId
{
"@type": "flatFileAttrs",
"delimiter": ",",
"textQualifier": "'",
"escapeChar": "\\"
}

Updating fields in objects with non-flat file formats

Use the fields resource to update fields in a source or target object in a non-flat file format such as Avro, Parquet, ORC, or JSON.

POST request

For Avro, Parquet, ORC, and JSON formats, you can update fields in the source or target object by including the format type and optionally, the schema. If you don't include the schema, the schema format is inferred from the data file.
Use one of the following URIs:
The following table describes the attributes to include in the dataFormat object:
Field
Type
Required
Description
formatId
String
Yes
Format type, for example, Avro.
schema
String
--
Schema format.

POST request example

To update fields in a Parquet source object, you might use the following request:
POST <serverUrl>/api/v2/connection/source/0100000B00000000000F/fields?objectName=infa.qa.bucket%2Fcustomer.parquet
1.0
Content-Type: application/xml
Accept: application/xml
icSessionId: <icSessionId>
{
"@type": "dataFormat",
"dformatId": "Parquet",
"schema": "message AllData_root { optional int32 c_custkey; optional binary c_name (UTF8); optional binary c_address (UTF8); optional int64 c_nationkey; optional binary c_phone (UTF8); optional double c_acctbal; optional binary c_mktsegment (UTF8); required binary c_comment (UTF8);}"
}
A successful response might look like the following example:
[
{
"@type": "field",
"id": -1,
"name": "c_custkey",
"type": "parquet_int32",
"uniqueName": "c_custkey",
"label": "c_custkey",
"parentObject": "customer_tgt.parquet",
"pcType": "INTEGER",
"precision": 10,
"scale": 0,
"columnIndex": -1,
"isKey": false,
"isExternalId": false,
"isSfIdLookup": false,
"isNullable": true,
"isUnique": false,
"isCreateable": false,
"isUpdateable": true,
"isFilterable": true,
"isCalculated": false,
"javaType": "java.lang.Integer",
"showLabel": true,
"naturalOrder": 0,
"linkedFields": [],
"relatedInfos": [],
"references": []
},
{
"@type": "field",
"id": -1,
"name": "c_address",
"type": "parquet_string",
"uniqueName": "c_address",
"label": "c_address",
"parentObject": "customer_tgt.parquet",
"pcType": "NSTRING",
"precision": 4000,
"scale": 0,
"columnIndex": -1,
"isKey": false,
"isExternalId": false,
"isSfIdLookup": false,
"isNullable": true,
"isUnique": false,
"isCreateable": false,
"isUpdateable": true,
"isFilterable": true,
"isCalculated": false,
"javaType": "java.lang.String",
"showLabel": true,
"naturalOrder": 2,
"linkedFields": [],
"relatedInfos": [],
"references": []
},
{
"@type": "field",
"id": -1,
"name": "c_nationkey",
"type": "parquet_int64",
"uniqueName": "c_nationkey",
"label": "c_nationkey",
"parentObject": "customer_tgt.parquet",
"pcType": "BIGINT",
"precision": 19,
"scale": 0,
"columnIndex": -1,
"isKey": false,
"isExternalId": false,
"isSfIdLookup": false,
"isNullable": true,
"isUnique": false,
"isCreateable": false,
"isUpdateable": true,
"isFilterable": true,
"isCalculated": false,
"javaType": "java.math.BigInteger",
"showLabel": true,
"naturalOrder": 3,
"linkedFields": [],
"relatedInfos": [],
"references": []
},
{
"@type": "field",
"id": -1,
"name": "FileName",
"type": "string",
"uniqueName": "FileName",
"label": "FileName",
"parentObject": "customer_tgt.parquet",
"pcType": "NSTRING",
"precision": 1024,
"scale": 0,
"columnIndex": -1,
"isKey": false,
"isExternalId": false,
"isSfIdLookup": false,
"isNullable": false,
"isUnique": false,
"isCreateable": false,
"isUpdateable": true,
"isFilterable": true,
"isCalculated": false,
"javaType": "java.lang.String",
"showLabel": true,
"naturalOrder": 8,
"linkedFields": [],
"relatedInfos": [],
"references": []
}
]