🕐 2 min read
The Request data source metadata method provides you with information about the queryable fields in a data source. This method requires that you pass in the data source object, as shown in this example:
{
"datasource": {
"datasourceLuid": "1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b",
}
}
The request has the following options:
bypassMetadataCache: Set to true if either the published data source or the underlying database has changed within your current session. When set to true, VizQL Dat Service (VDS) refreshes the metadata.interpretFieldCaptionsAsFieldNames: When set to true, the response returns the fieldName value everywhere the fieldCaption is used. This is also true for parameters. For example, if you set this field to true, the response returns, for example, Parameter 2 instead of Profit Bin Size.This API method returns two objects: data and extraData. The data object returns these fields:
fieldName: The underlying field name on the data source.fieldCaption: This is what you need to pass into a query. This is often the same as fieldName.dataType: Either INTEGER, REAL, STRING, DATETIME, BOOLEAN, DATE, SPATIAL, or UNKNOWN.defaultAggreation: The default aggregation applied to the field.columnClass: The type of field. Either COLUMN, BIN, GROUP, CALCULATION, or TABLE_CALCULATION.formula: The formula for this field if it is a calculation.logicalTableId: If you have a data model with more than one logical table, this tells you which table the field originated from.The extraData object returns a parameters object with these fields:
parameterType: Either ANY_VALUE (accepts any value without restrictions), LIST (a set number of values from which you can choose), QUANTITATIVE_DATE (a date range with specified minimum, maximum, and granularity settings), QUANTITATIVE_RANGE (a numeric range with specified minimum, maximum, and step values), or ALL (no restrictions).parameterName: The internal name defined by Tableau.parameterCaption: The user-defined name of the parameter to identify and reference the parameter.dataType: Either INTEGER, REAL, STRING, BOOLEAN, and DATE.value: The default value for the parameter.min: The maximum value for the range.max: The minimum value for the range.step: The jumps between values.DATETIME and SPATIAL are currently not supported parameter dataType values.{
"data": [
{
"fieldName": "Profit (bin)",
"fieldCaption": "Profit (bin)",
"dataType": "INTEGER",
"defaultAggregation": "NONE",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "BIN"
}
]
}
{
"data": [
{
"fieldName": "Category (group)",
"fieldCaption": "Category (group)",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "GROUP"
}
]
}
{
"data": [
{
"fieldName": "Calculation_1368249927221915648",
"fieldCaption": "Profit Ratio",
"dataType": "REAL",
"defaultAggregation": "AGG",
"columnClass": "CALCULATION",
"formula": "SUM([Profit])/SUM([Sales])"
}
]
}
{
"data": [
{
"fieldName": "Calculation_1890667447609004040",
"fieldCaption": "TableCalc",
"dataType": "REAL",
"defaultAggregation": "AGG",
"columnClass": "TABLE_CALCULATION",
"formula": "RUNNING_SUM(SUM([Sales]))"
},
{
"fieldName": "Category",
"fieldCaption": "Category",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Regional Manager",
"fieldCaption": "Regional Manager",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "People_D73023733B004CC1B3CB1ACF62F4A965",
"columnClass": "COLUMN"
},
{
"fieldName": "Ship Date",
"fieldCaption": "Ship Date",
"dataType": "DATE",
"defaultAggregation": "YEAR",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Sub-Category",
"fieldCaption": "Sub-Category",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Profit (bin)",
"fieldCaption": "Profit (bin)",
"dataType": "INTEGER",
"defaultAggregation": "NONE",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "BIN"
},
{
"fieldName": "Segment",
"fieldCaption": "Segment",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Sales",
"fieldCaption": "Sales",
"dataType": "REAL",
"defaultAggregation": "SUM",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Ship Mode",
"fieldCaption": "Ship Mode",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Discount",
"fieldCaption": "Profit",
"dataType": "REAL",
"defaultAggregation": "SUM",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Order Date",
"fieldCaption": "Order Date",
"dataType": "DATE",
"defaultAggregation": "YEAR",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Calculation_1368249927221915648",
"fieldCaption": "Profit Ratio",
"dataType": "REAL",
"defaultAggregation": "AGG",
"columnClass": "CALCULATION",
"formula": "SUM([Profit])/SUM([Sales])"
},
{
"fieldName": "Customer Name",
"fieldCaption": "Customer Name",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Returned",
"fieldCaption": "Returned",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Returns_2AA0FE4D737A4F63970131D0E7480A03",
"columnClass": "COLUMN"
},
{
"fieldName": "Postal Code",
"fieldCaption": "Postal Code",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Order ID",
"fieldCaption": "Order ID",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Product Name",
"fieldCaption": "Product Name",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Quantity",
"fieldCaption": "Quantity",
"dataType": "INTEGER",
"defaultAggregation": "SUM",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "City",
"fieldCaption": "City",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Sales (bin)",
"fieldCaption": "Sales (bin)",
"dataType": "INTEGER",
"defaultAggregation": "NONE",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "BIN"
},
{
"fieldName": "State/Province",
"fieldCaption": "State/Province",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Profit",
"fieldCaption": "Profit Caption",
"dataType": "REAL",
"defaultAggregation": "SUM",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Region",
"fieldCaption": "Region",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Country/Region",
"fieldCaption": "Country/Region",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "COLUMN"
},
{
"fieldName": "Calculation_1890667447610966025",
"fieldCaption": "Disaggregated Calc",
"dataType": "REAL",
"defaultAggregation": "SUM",
"columnClass": "CALCULATION",
"formula": "1+2.5"
},
{
"fieldName": "Category (group)",
"fieldCaption": "Category (group)",
"dataType": "STRING",
"defaultAggregation": "COUNT",
"logicalTableId": "Orders_ECFCA1FB690A41FE803BC071773BA862",
"columnClass": "GROUP"
}
],
"extraData": {
"parameters": [
{
"parameterType": "LIST",
"parameterName": "Parameter 3",
"parameterCaption": "Greeting String",
"dataType": "STRING",
"value": "Hello",
"members": [
"Hello",
"Hi",
"Greetings",
"Hey"
]
},
{
"parameterType": "QUANTITATIVE_RANGE",
"parameterName": "Parameter 1",
"parameterCaption": "Top Customers",
"dataType": "INTEGER",
"value": 5.0,
"min": 5.0,
"max": 20.0,
"step": 5.0
},
{
"parameterType": "QUANTITATIVE_RANGE",
"parameterName": "Parameter 2",
"parameterCaption": "Profit Bin Size",
"dataType": "INTEGER",
"value": 200.0,
"min": 50.0,
"max": 200.0,
"step": 50.0
}
]
}
}