API Stability |
Long-Term
|
The getFileContent() GraphQL query is used to get contents of a CSV file.
See the newFile() for information creating a new file, and updateFile() for updating data in an already uploaded or created file. You might also want to see the Lookup Files documentation page, if that's related to your reason for uploading a file.
Syntax
Below is the syntax for the getFileContent() query field:
getFileContent(
name: string!
fileName: string!
filterString: string
offset: integer
limit: integer
): UploadedFileSnapshot!
For the input, there are several parameters, with the the basic datatypes of strings and integers. They're described in the Given Datatypes section below. What to use for the return, for UploadedFileSnapshot is listed in the Results Datatypes section. Below is an example with fictitious data.
query {
getFileContent(
fileName: "test.csv",
name: "humio",
filterString: "Barbara"
)
{ nameAndPath{name, path},
totalLinesCount,
headers, lines
}
}
{
"data": {
"getFileContent": {
"nameAndPath": {
"name": "test.csv",
"path": null
},
"totalLinesCount": 1,
"headers": [
"id",
"first",
"last"
],
"lines": [
[
"6",
"Barbara",
"Mills"
]
]
}
}
}
This example is gets the file from the repository, and returns rows containing the search text given for filterString. It also returns the name and path of the file, and the number of rows found — which is only one here. And it returns the data found matching the search text.
Given Datatypes
The given datatypes are described in the table below:
Table: Mix of Input for getFileContent
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Sep 10, 2024 | |||||
name | string | yes | The name of the repository associated with the file. | ||
fileName | string | yes | The name of the uploaded or created file. | ||
filterString | string | Case-insensitive text on which to search the row. | |||
limit | integer | 50 | The maximum number of rows to return from the file. | ||
offset | integer | 0 | The initial number of rows to skip; display only rows after number given. |
Returned Datatypes
The returned datatype UploadedFileSnapshot
has its own parameters. Below is a list of them along with their
datatypes and a description of each:
Table: UploadedFileSnapshot
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Mar 27, 2025 | |||||
filterString | string | Long-Term | Any string on which to filter the data. | ||
headers | [string] | yes | Long-Term | The headers for the uploaded snapshot file. | |
limit | integer | yes | Long-Term | The file upload limit. | |
lines | [string] | yes | Long-Term | The contents of the file in the form of a list of lines, with each line being itself a list of column values. When the file is empty or nothing matches filterString, then [] is returned. | |
nameAndPath | FileNameAndPath | yes | Long-Term | The name and path of the uploaded snapshot file. See FileNameAndPath . | |
offset | integer | yes | Long-Term | This is the offset supplied to a file query. For a new or updated file, this is always 0. | |
resource | string | Short-Term | The resource identifier for the file. | ||
totalLinesCount | long | yes | Long-Term | The total number of lines in the uploaded snapshot file. |