Request body options
The request body is a JSON object that contains three root-level fields:
dataprojectArgumentsoptions
The data and projectArguments fields are described in Using a Studio app's API > The request body.
This topic covers the options field only. This field is optional and is usually omitted. The field includes settings that allow you to configure the runtime behavior for your project. The settings are:
nullValueBehaviourdefines what value to insert when an ATL statement returns an undefined or null result. You can give one of the following values:ERROR_IF_ANY_NULLcauses the generation of a runtime error. This error will be present in theerrorTypeanderrorMessagefields in the response object.SHOW_BLANKinserts a blank value (empty string).SHOW_IDENTIFIERinserts the original ATL syntax into the result so you can see the ATL content that led to the problem. This is the default behavior.
contentOutputFormatis optional and specifies whether the output text should be in HTML format or plain text format:HTML= HTML format (default).TEXT= plain text format.
contentLineEndingis optional and specifies line ending character(s) to be inserted in plain text format:The default is the line end characters for a carriage return and newline (i.e. "\r\n") but you can specify a single character (e.g. "\n") if you prefer. The character(s) you specify are inserted twice at paragraph breaks (e.g. "\r\n\r\n").
contentLineLengthis optional and specifies the maximum line length for insertion of line breaks in plain text format. Words are not broken across line breaks; consequently, some lines may be shorter than the maximum length:An integer denoting the maximum length for a line line (e.g. 20). The default is for no maximum line length, meaning no line breaks are inserted.
templateFragmentis optional and allows you to call a specific ATL script (but not a user-defined function) or ATL fragment. It can include the following settings:fragmentNameenables you to call a specific named ATL script. For instance, a call to the CapitalCity subscript in the "Describe Row in Context" sample project will output the text generated from that subscript only.selectionIndexis used withfragmentNameandselectionLengthto produce a substring of the output text.selectionIndexis the start index of the substring; an error occurs if it is outside the range of the script.selectionLengthis used withfragmentNameandselectionIndexto produce a substring of the output text.selectionLengthis the length of the substring; an error occurs if it goes past the end of the script.fragmentTextallows you to call the API with a string of ATL. For example, if you input the stringThis report describes Australian states: [[RowNames]].in a call to the Describe Row in Context" sample project, the output is:This report describes the Australian states: New South Wales, Victoria, Queensland, Western Australia, South Australia, Tasmania, the Australian Capital Territory and the Northern Territory.
In a body request, this would like this:
"fragmentText": "This report describes Australian states: [[RowNames]]Note:
fragmentTextshould not be used together withfragmentName.
Example
The following request body works with a published version of the "Describe Each Row" sample project.
This example uses all five of the main settings mentioned above.
{
"data": [{
"id": "Primary",
"type": "1d",
"dataSet": [
["State", "Premier", "Party", "Terms", "StateLandArea", "StatePop2010", "StatePop2016", "Capital", "CapitalPop2010", "CapitalPop2016"],
["Victoria", "Daniel Andrews", "ALP", "1", "227,416", "5,547,500", "5,938,100", "Melbourne", "3,953,939", "4,353,514"],
["New South Wales", "Gladys Berejiklian", "Liberal", "1", "800,641", "7,238,800", "7,618,200", "Sydney", "4,183,471", "4,526,479"],
["Queensland", "Annastacia Palaszczuk", "ALP", "1", "1,730,647", "4,516,400", "4,779,400", "Brisbane", "2,019,074", "2,209,453"],
["Western Australia", "Colin Barnett", "Liberal", "2", "2,529,875", "2,296,400", "2,591,600", "Perth", "1,723,218", "1,958,912"],
["South Australia", "Jay Weatherill", "ALP", "2", "983,482", "1,644,600", "1,698,600", "Adelaide", "1,225,668", "1,288,681"],
["Tasmania", "Will Hodgman", "Liberal", "1", "68,401", "507,600", "516,600", "Hobart", "203,446", "209,254"],
["Australian Capital Territory", "Andrew Barr", "ALP", "1", "2,358", "358,900", "395,200", "Canberra", "355,596", "381,488"],
["Northern Territory", "Michael Gunner", "ALP", "1", "1,349,129", "229,700", "244,600", "Darwin", "112,987", "123,396"]
]
}],
"options": {
"nullValueBehaviour": "SHOW_IDENTIFIER",
"contentOutputFormat": "TEXT",
"contentLineEnding": "\n",
"contentLineLength": 50,
"templateFragment": {
"fragmentName": "Main"
}
}
}
Note
Note how the fragmentName setting is entered as a key within the templateFragment setting. All templateFragment settings must be entered this way.