Data Studio Service

  • The Data Studio service allows scripts to access and modify Data Studio Community Connectors.

  • It provides classes and methods for interacting with various aspects of Data Studio connectors, including configuration, fields, authentication, and data retrieval.

  • Enums are defined for aggregation types, authentication types, BigQuery parameter types, and field types.

  • Builders are available for creating responses for authentication type, data, schema, and set credentials requests.

  • Error handling can be implemented using DebugError for admin-only errors and UserError for errors visible to users.

Data Studio

This service allows scripts to access and modify Data StudioCommunity Connectors.

Classes

NameBrief description
AggregationTypeAn enum that defines the aggregation types that can be set for aField.
AuthTypeAn enum that defines the authentication types that can be set for a connector.
BigQueryConfigA configuration object for a native BigQuery connector.
BigQueryParameterTypeAn enum that defines the BigQuery parameter types that you can set.
CheckboxContains checkbox information for the config.
CommunityConnectorCommunityConnector enables scripts to access builders and utilities to help with development ofCommunity Connectors for Data Studio.
ConfigContains the configuration entries for a connector.
DataStudioAppDataStudioApp allows scripts to interact with developer-oriented features for Data Studio.
DebugErrorAn error that is only visible to admins of the connector.
FieldContains field-related data.
FieldTypeAn enum that defines the types that can be set for aField.
FieldsContains a set ofFields for a community connector.
GetAuthTypeResponseBuilder to create agetAuthType() response for your script project.
GetDataResponseBuilder to create agetData() response for your script project.
GetSchemaResponseBuilder to create agetSchema() response for your script project.
InfoContains info data for the config.
OptionBuilderA builder for creating options forSelectSingles andSelectMultiples.
SelectMultipleContains select multiple information for the config.
SelectSingleContains select single information for the config.
SetCredentialsResponseBuilder to create asetCredentials() response for your script project.
TextAreaContains text area information for the config.
TextInputContains text input information for the config.
UserErrorAn error that is shown to users of the connector.

AggregationType

Properties

PropertyTypeDescription
AVGEnumAverage.
COUNTEnumCount.
COUNT_DISTINCTEnumCount Distinct.
MAXEnumMax.
MINEnumMin.
SUMEnumSum.
AUTOEnumAuto.

AuthType

Properties

PropertyTypeDescription
NONEEnumNo authorization needed.
OAUTH2EnumOAuth2 authorization needed.
USER_PASSEnumUsername and password credentials needed.
PATH_USER_PASSEnumUsername, path, and password needed.
PATH_KEYEnumPath and key needed.
KEYEnumAPI Key or Token needed.
USER_TOKENEnumUsername and token needed.

BigQueryConfig

Methods

MethodReturn typeBrief description
addQueryParameter(name, type, value)BigQueryConfigAdds a query parameter to thisBigQueryConfig.
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setAccessToken(accessToken)BigQueryConfigSets the access token of thisBigQueryConfig.
setBillingProjectId(billingProjectId)BigQueryConfigSets the billing project ID of thisBigQueryConfig.
setQuery(query)BigQueryConfigSets the SQL query of thisBigQueryConfig.
setUseStandardSql(useStandardSql)BigQueryConfigDetermines if the query is interpreted as standard or legacy SQL.

BigQueryParameterType

Properties

PropertyTypeDescription
STRINGEnumString.
INT64Enum64-bit integer.
BOOLEnumBoolean.
FLOAT64Enum64-bit floating point number.

Checkbox

Methods

MethodReturn typeBrief description
setAllowOverride(allowOverride)CheckboxEnables overriding for this config entry.
setHelpText(helpText)CheckboxSets the help text for this configuration entry.
setId(id)CheckboxSets the unique ID for this configuration entry.
setIsDynamic(isDynamic)CheckboxSets the dynamic status for this configuration entry.
setName(name)CheckboxSets the display name for this configuration entry.

CommunityConnector

Properties

PropertyTypeDescription
AggregationTypeAggregationTypeTheAggregationType enumeration.
AuthTypeAuthTypeTheAuthType enumeration.
BigQueryParameterTypeBigQueryParameterTypeTheBigQueryParameterType enumeration.
FieldTypeFieldTypeTheFieldType enumeration.

Methods

MethodReturn typeBrief description
getConfig()ConfigReturns aConfig object.
getFields()FieldsReturns aFields object.
newAuthTypeResponse()GetAuthTypeResponseReturns a newGetAuthTypeResponse object.
newBigQueryConfig()BigQueryConfigReturns a newBigQueryConfig object.
newDebugError()DebugErrorReturns a newDebugError object.
newGetDataResponse()GetDataResponseReturns a newGetDataResponse object.
newGetSchemaResponse()GetSchemaResponseReturns a newGetSchemaResponse object.
newSetCredentialsResponse()SetCredentialsResponseReturns a newSetCredentialsResponse object.
newUserError()UserErrorReturns a newUserError object.

Config

Methods

MethodReturn typeBrief description
build()ObjectValidates this object and returns it in the format needed by Data Studio.
newCheckbox()CheckboxReturns a new checkbox configuration entry.
newInfo()InfoReturns a new info configuration entry.
newOptionBuilder()OptionBuilderReturns a new options builder.
newSelectMultiple()SelectMultipleReturns a new select multiple configuration entry.
newSelectSingle()SelectSingleReturns a new select single configuration entry.
newTextArea()TextAreaReturns a new text area configuration entry.
newTextInput()TextInputReturns a new text input configuration entry.
printJson()StringPrints the JSON representation of this object.
setDateRangeRequired(dateRangeRequired)ConfigIftrue, a date range is provided for getData() requests.
setIsSteppedConfig(isSteppedConfig)ConfigIftrue,getConfig() is called again with the current user configuration.

DataStudioApp

Methods

MethodReturn typeBrief description
createCommunityConnector()CommunityConnectorCreates a new Community Connector.

DebugError

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.
setText(text)DebugErrorSets the text of the debug error, which is only shown to admins.
throwException()voidTriggers this exception to be thrown.

Field

Methods

MethodReturn typeBrief description
getAggregation()AggregationTypeReturns theAggregationType of thisField.
getDescription()StringReturns the description of thisField.
getFormula()StringReturns the formula of thisField.
getGroup()StringReturns the group of thisField.
getId()StringReturns the ID of thisField.
getIsReaggregatable()BooleanReturnstrue if this field can be reaggregated,false otherwise.
getName()StringReturns the name of thisField.
getType()FieldTypeReturns theFieldType of thisField.
isDefault()BooleanReturnstrue if thisField is the default metric or dimension.
isDimension()BooleanReturnstrue if this field is a dimension.
isHidden()BooleanReturnstrue if thisField is hidden.
isMetric()BooleanReturnstrue if this field is a metric.
setAggregation(aggregation)FieldSets the aggregation type of thisField.
setDescription(description)FieldSets the description of thisField.
setFormula(formula)FieldSets the formula of thisField.
setGroup(group)FieldSets the group of thisField.
setId(id)FieldSets the ID of thisField.
setIsHidden(isHidden)FieldSets the hidden status of thisField.
setIsReaggregatable(isReaggregatable)FieldSets the reaggregation-permitted status for aField.
setName(name)FieldSets the name of thisField.
setType(type)FieldSets theFieldType of thisField.

FieldType

Properties

PropertyTypeDescription
YEAREnumYear in the format of YYYY such as 2017.
YEAR_QUARTEREnumYear and quarter in the format of YYYYQ such as 20171.
YEAR_MONTHEnumYear and month in the format of YYYYMM such as 201703.
YEAR_WEEKEnumYear and week in the format of YYYYww such as 201707.
YEAR_MONTH_DAYEnumYear, month, and day in the format of YYYYMMDD such as 20170317.
YEAR_MONTH_DAY_HOUREnumYear, month, day, and hour in the format of YYYYMMDDHH such as 2017031703.
YEAR_MONTH_DAY_MINUTEEnumYear, month, day, hour, and minute in the format of YYYYMMDDHHmm such as 201703170230.
YEAR_MONTH_DAY_SECONDEnumYear, month, day, hour, minute, and second in the format of YYYYMMDDHHmmss such as20170317023017.
QUARTEREnumQuarter in the format of 1, 2, 3, or 4).
MONTHEnumMonth in the format of MM such as 03.
WEEKEnumWeek in the format of ww such as 07.
MONTH_DAYEnumMonth and day in the format of MMDD such as 0317.
DAY_OF_WEEKEnumA number in the range of [0,6] with 0 representing Sunday.
DAYEnumDay in the format of DD such as 17.
HOUREnumHour in the format of HH such as 13.
MINUTEEnumMinute in the format of mm such as 12.
DURATIONEnumA duration of time in seconds.
COUNTRYEnumA country such as United States.
COUNTRY_CODEEnumA country code such as US.
CONTINENTEnumA continent such as Americas.
CONTINENT_CODEEnumA continent code such as 019.
SUB_CONTINENTEnumA sub-continent such as North America.
SUB_CONTINENT_CODEEnumA sub-continent code such as 003.
REGIONEnumA region such as California.
REGION_CODEEnumA region code such as CA.
CITYEnumA city such as Mountain View.
CITY_CODEEnumA city code such as 1014044.
METROEnumA metro such as San Francisco-Oakland-San Jose CA.
METRO_CODEEnumA metro code such as 200807.
LATITUDE_LONGITUDEEnumA latitude longitude pair such as 51.5074, -0.1278.
NUMBEREnumA decimal number.
PERCENTEnumDecimal percentage (can be over 1.0).
TEXTEnumFree-form text.
BOOLEANEnumAtrue orfalse boolean value.
URLEnumA URL as text such as https://google.com.
HYPERLINKEnumA hyperlink.
IMAGEEnumAn image.
IMAGE_LINKEnumAn image link.
CURRENCY_AEDEnumCurrency from AED.
CURRENCY_ALLEnumCurrency from ALL.
CURRENCY_ARSEnumCurrency from ARS.
CURRENCY_AUDEnumCurrency from AUD.
CURRENCY_BDTEnumCurrency from BDT.
CURRENCY_BGNEnumCurrency from BGN.
CURRENCY_BOBEnumCurrency from BOB.
CURRENCY_BRLEnumCurrency from BRL.
CURRENCY_CADEnumCurrency from CAD.
CURRENCY_CDFEnumCurrency from CDF.
CURRENCY_CHFEnumCurrency from CHF.
CURRENCY_CLPEnumCurrency from CLP.
CURRENCY_CNYEnumCurrency from CNY.
CURRENCY_COPEnumCurrency from COP.
CURRENCY_CRCEnumCurrency from CRC.
CURRENCY_CZKEnumCurrency from CZK.
CURRENCY_DKKEnumCurrency from DKK.
CURRENCY_DOPEnumCurrency from DOP.
CURRENCY_EGPEnumCurrency from EGP.
CURRENCY_ETBEnumCurrency from ETB.
CURRENCY_EUREnumCurrency from EUR.
CURRENCY_GBPEnumCurrency from GBP.
CURRENCY_HKDEnumCurrency from HKD.
CURRENCY_HRKEnumCurrency from HRK.
CURRENCY_HUFEnumCurrency from HUF.
CURRENCY_IDREnumCurrency from IDR.
CURRENCY_ILSEnumCurrency from ILS.
CURRENCY_INREnumCurrency from INR.
CURRENCY_IRREnumCurrency from IRR.
CURRENCY_ISKEnumCurrency from ISK.
CURRENCY_JMDEnumCurrency from JMD.
CURRENCY_JPYEnumCurrency from JPY.
CURRENCY_KRWEnumCurrency from KRW.
CURRENCY_LKREnumCurrency from LKR.
CURRENCY_LTLEnumCurrency from LTL.
CURRENCY_MNTEnumCurrency from MNT.
CURRENCY_MVREnumCurrency from MVR.
CURRENCY_MXNEnumCurrency from MXN.
CURRENCY_MYREnumCurrency from MYR.
CURRENCY_NGNEnumCurrency from NGN.
CURRENCY_NOKEnumCurrency from NOK.
CURRENCY_NZDEnumCurrency from NZD.
CURRENCY_PABEnumCurrency from PAB.
CURRENCY_PENEnumCurrency from PEN.
CURRENCY_PHPEnumCurrency from PHP.
CURRENCY_PKREnumCurrency from PKR.
CURRENCY_PLNEnumCurrency from PLN.
CURRENCY_RONEnumCurrency from RON.
CURRENCY_RSDEnumCurrency from RSD.
CURRENCY_RUBEnumCurrency from RUB.
CURRENCY_SAREnumCurrency from SAR.
CURRENCY_SEKEnumCurrency from SEK.
CURRENCY_SGDEnumCurrency from SGD.
CURRENCY_THBEnumCurrency from THB.
CURRENCY_TRYEnumCurrency from TRY.
CURRENCY_TWDEnumCurrency from TWD.
CURRENCY_TZSEnumCurrency from TZS.
CURRENCY_UAHEnumCurrency from UAH.
CURRENCY_USDEnumCurrency from USD.
CURRENCY_UYUEnumCurrency from UYU.
CURRENCY_VEFEnumCurrency from VEF.
CURRENCY_VNDEnumCurrency from VND.
CURRENCY_YEREnumCurrency from YER.
CURRENCY_ZAREnumCurrency from ZAR.

Fields

Methods

MethodReturn typeBrief description
asArray()Field[]Returns a view of this object as an array.
build()Object[]Validates this object and returns it in the format needed by Data Studio.
forIds(ids)FieldsReturns a newFields object filtered toFields with an ID inids.
getDefaultDimension()FieldReturns the default dimension to be used for the set of fields.
getDefaultMetric()FieldReturns the default metric to be used for the set of fields.
getFieldById(fieldId)FieldReturns a field with a given ID, ornull if no field with that ID is in thisFields object.
newDimension()FieldReturns a new dimensionField.
newMetric()FieldReturns a new metricField.
setDefaultDimension(fieldId)voidSets the default dimension to be used for the set of fields.
setDefaultMetric(fieldId)voidSets the default metric to be used for the set of fields.

GetAuthTypeResponse

Methods

MethodReturn typeBrief description
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setAuthType(authType)GetAuthTypeResponseSets theAuthType of the builder.
setHelpUrl(helpUrl)GetAuthTypeResponseSets the help URL of the builder.

GetDataResponse

Methods

MethodReturn typeBrief description
addAllRows(rows)GetDataResponseAdds multiple rows of data to thisGetDataResponse.
addRow(row)GetDataResponseAdds a row of data to thisGetDataResponse.
build()ObjectValidates this object and returns it in the format needed by Data Studio.
setFields(fields)GetDataResponseSets theFields of the builder.
setFiltersApplied(filtersApplied)GetDataResponseSets the filters applied status for this builder.

GetSchemaResponse

Methods

MethodReturn typeBrief description
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setFields(fields)GetSchemaResponseSets theFields of the builder.

Info

Methods

MethodReturn typeBrief description
setId(id)InfoSets the unique ID for this configuration entry.
setText(text)InfoSets the text for this configuration entry.

OptionBuilder

Methods

MethodReturn typeBrief description
setLabel(label)OptionBuilderSets the label of this option builder.
setValue(value)OptionBuilderSets the value of this option builder.

SelectMultiple

Methods

MethodReturn typeBrief description
addOption(optionBuilder)SelectMultipleAdds a new select option.
setAllowOverride(allowOverride)SelectMultipleEnables overriding for this config entry.
setHelpText(helpText)SelectMultipleSets the help text for this configuration entry.
setId(id)SelectMultipleSets the unique ID for this configuration entry.
setIsDynamic(isDynamic)SelectMultipleSets the dynamic status for this configuration entry.
setName(name)SelectMultipleSets the display name for this configuration entry.

SelectSingle

Methods

MethodReturn typeBrief description
addOption(optionBuilder)SelectSingleAdds a new select option.
setAllowOverride(allowOverride)SelectSingleEnables overriding for this config entry.
setHelpText(helpText)SelectSingleSets the help text for this configuration entry.
setId(id)SelectSingleSets the unique ID for this configuration entry.
setIsDynamic(isDynamic)SelectSingleSets the dynamic status for this configuration entry.
setName(name)SelectSingleSets the display name for this configuration entry.

SetCredentialsResponse

Methods

MethodReturn typeBrief description
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setIsValid(isValid)SetCredentialsResponseSets the valid status of thisSetCredentialsResponse.

TextArea

Methods

MethodReturn typeBrief description
setAllowOverride(allowOverride)TextAreaEnables overriding for this config entry.
setHelpText(helpText)TextAreaSets the help text for this configuration entry.
setId(id)TextAreaSets the unique ID for this configuration entry.
setIsDynamic(isDynamic)TextAreaSets the dynamic status for this configuration entry.
setName(name)TextAreaSets the display name for this configuration entry.
setPlaceholder(placeholder)TextAreaSets the placeholder text for this configuration entry.

TextInput

Methods

MethodReturn typeBrief description
setAllowOverride(allowOverride)TextInputEnables overriding for this config entry.
setHelpText(helpText)TextInputSets the help text for this configuration entry.
setId(id)TextInputSets the unique ID for this configuration entry.
setIsDynamic(isDynamic)TextInputSets the dynamic status for this configuration entry.
setName(name)TextInputSets the display name for this configuration entry.
setPlaceholder(placeholder)TextInputSets the placeholder text for this configuration entry.

UserError

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.
setDebugText(text)UserErrorSets the text of the debug error, which is only shown to admins.
setText(text)UserErrorSets the text of the user error.
throwException()voidTriggers this exception to be thrown.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.