REST API Reference > Data Integration REST API > Data preview
  

Data preview

Use this resource to preview data during mapping design. By default, the response returns up to ten rows of data for the specified object.

GET request

To request preview data, specify the connection ID or connection name and the object name in the URI. Optionally, you can include field format information in the request.
Use one of the following URIs:
You can receive field metadata in the response for flat file, Avro, Parquet, Orc, or JSON formats. To receive field metadata, include file format information in the request body.
For flat file format, you can include the following information in the flatFileAttrs object:
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.
For Avro, Parquet, Orc, or JSON formats, include the following information in the dataFormat object:
Field
Type
Required
Description
formatId
String
Yes
Format type, for example, Avro.
schema
String
--
Schema format.
By default, the dataPreview response returns 10 rows. For flat file connections, you can specify the number of rows using the numRows parameter as shown in the following example:
/api/v2/connection/source/<id>/datapreview/?objectName=<object name>&numRows=<number of rows to view>
You can also specify the beginning row using the startRowNum parameter as shown in the following example:
/api/v2/connection/source/<id>/datapreview/?objectName=<object name>&startRowNum=<row number of row to begin with>
Note: 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/target/name/my%20connection/datapreview/SF_ACCOUNT.csv

GET response

Returns the dataPreview object for the requested connection ID or connection name and object name.
The dataPreview object includes the following attributes:
Field
Type
Description
connId
String
Connection ID.
objectName
String
Name of the source or target object.
header
String
Column headers.
fieldName
String
Field name.
fieldBusinessName
String
Business field name.
data
Includes the following attribute in the dataPreviewEntry object.
values
String
Included in the dataPreviewEntry object. Field values from the source or target object.

GET request examples

The following example shows a request to preview data from the SF_ACCOUNT.csv object:
GET <serverUrl>/api/v2/connection/target/0000010B000000000003/datapreview/SF_ACCOUNT.csv HTTP/1.0
Accept:application/json
icSessionId: <icSessionId>
The following example shows a request to preview data from the customer.parquet object.
POST <serverUrl>/api/v2/connection/source/0000010B000000000009/datapreview?objectName=customer.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);}"
}

GET response example

You might receive a response similar to the following example:
{

"@type": "dataPreview",
"connId": "0000010B000000000003",
"objectName": "SF_ACCOUNT.csv",
"header": [
"ID",
"ISDELETED",
"MASTERRECORDID",
"NAME",
"TYPE",
"PARENTID",
"BILLINGSTREET",
"BILLINGCITY",
"BILLINGSTATE",
"BILLINGPOSTALCODE",
"BILLINGCOUNTRY",
"BILLINGLATITUDE",
"BILLINGLONGITUDE",
"SHIPPINGSTREET",
"SHIPPINGCITY",
"SHIPPINGSTATE",
"SHIPPINGPOSTALCODE",
"SHIPPINGCOUNTRY",
"SHIPPINGLATITUDE",
"SHIPPINGLONGITUDE",
"PHONE",
"FAX",
"ACCOUNTNUMBER",
"WEBSITE"
],

"fieldName": [
"ID",
"ISDELETED",
"MASTERRECORDID",
"NAME",
"TYPE",
"PARENTID",
"BILLINGSTREET",
"BILLINGCITY",
"BILLINGSTATE",
"BILLINGPOSTALCODE",
"BILLINGCOUNTRY",
"BILLINGLATITUDE",
"BILLINGLONGITUDE",
"SHIPPINGSTREET",
"SHIPPINGCITY",
"SHIPPINGSTATE",
"SHIPPINGPOSTALCODE",
"SHIPPINGCOUNTRY",
"SHIPPINGLATITUDE",
"SHIPPINGLONGITUDE",
"PHONE",
"FAX",
"ACCOUNTNUMBER",
"WEBSITE"
],

"fieldBusinessName": [
"ID",
"ISDELETED",
"MASTERRECORDID",
"NAME",
"TYPE",
"PARENTID",
"BILLINGSTREET",
"BILLINGCITY",
"BILLINGSTATE",
"BILLINGPOSTALCODE",
"BILLINGCOUNTRY",
"BILLINGLATITUDE",
"BILLINGLONGITUDE",
"SHIPPINGSTREET",
"SHIPPINGCITY",
"SHIPPINGSTATE",
"SHIPPINGPOSTALCODE",
"SHIPPINGCOUNTRY",
"SHIPPINGLATITUDE",
"SHIPPINGLONGITUDE",
"PHONE",
"FAX",
"ACCOUNTNUMBER",
"WEBSITE"
],

"rows": [
{
"@type": "dataPreviewEntry",
"values": [
"001i000000KIAQGAA5",
"0",
"",
"ABCPoint",
"Customer - Channel",
"",
"345 ABC Park",
"Mountain View",
"CA",
"94063",
"",
"",
"",
"345 ABC Park",
"Mountain View",
"CA",
"94063",
"",
"",
"",
"(650) 555-3450",
"(650) 555-9895",
"CC978213",
"www.ABCpoint.com"
]
},

{
"@type": "dataPreviewEntry",
"values": [
"001i000000KIAQHAA5",
"0",
"",
"123 United, UK",
"Customer - Direct",
"",
"123 Estate,\nGateshead, Tyne and Wear NE26 3HS\nUnited Kingdom",
"",
"UK",
"94063",
"",
"",
"",
"123 Estate,\nGateshead, Tyne and Wear NE26 3HS\nUnited Kingdom",
"",
"",
"94063",
"",
"",
"",
"+44 123 4567899",
"+44 123 4567899",
"CD355119-A",
"http://www.123United.com"
]

}