Summary

The updateFile() GraphQL mutation may be used to change a file in LogScale.

API Stability Long-Term
Security Requirement & Control UpdateFiles API permission

Syntax

graphql
updateFile(
     fileName: string!,
     name: string!,
     changedRows: [string]!,
     headers: [string]!,
     limit: integer,
     offset: integer,
     labels: [string]
     columnChanges: [ColumnChange]!
   ): UploadedFileSnapshot!

For the input, you'll have to give the name of the repository and the file, and the rows that are changed, and columns that are changed. You may also provide labels, an offset, and a limit. See the Input Parameters section for details.

For the results, you can get the file path, the number of lines the CSV file contains, any headers and other such information. See the Returned Values section for more.

Example

Raw
graphql
mutation {
  updateFile( 
       fileName: "somefile.csv",
       name: "humio",
       changedRows: [ "some", "thing"],
       headers: [ "my-header" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  updateFile(  ^
       fileName: \"somefile.csv\", ^
       name: \"humio\", ^
       changedRows: [ \"some\", \"thing\"], ^
       headers: [ \"my-header\" ], ^
       columnChanges: [ { changeKind: Remove, index: 1 } ] ^
  ) ^
  { lines } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  updateFile( 
       fileName: \"somefile.csv\",
       name: \"humio\",
       changedRows: [ \"some\", \"thing\"],
       headers: [ \"my-header\" ],
       columnChanges: [ { changeKind: Remove, index: 1 } ]
  )
  { lines }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "updateFile": {
      "lines": "4"
    }
  }
}

Input Parameters

For the input, you would provide the name of the repository and the file, and the rows that are changed, and columns that are changed (see second table below). You may also provide labels, an offset, and a limit. See the table below for more details.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation. Since one of the parameters uses a special datatype, an additional table is included below with its parameters.
changedRows [string] yes   The rows within the offset and limit. They will overwrite all existing rows that are also within the offset and limit.
columnChanges [ColumnChange] yes   List of column changes to all rows in file. Ordering determines which is executed first in results.
fileName string yes   The name of the file.
headers [string] yes   The table headers.
labels [string]     A list of labels associated with the file.
limit integer     The rows within the offset and limit. They will overwrite all existing rows that are also within the offset and limit.
name string yes   The name of the respository.
offset integer     Starting index to replace the old rows with the updated ones. It doesn't take into account the header row.

For the special input datatype, you'd indicate whether a column has been added or removed at a given index. The table below gives more details:

Table: ColumnChange Input Datatype

ParameterTypeRequiredDefaultStabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results.
Table last updated: Sep 17, 2024
changeKindColumnChangeKindyes Long-TermThe kind of column change. See ColumnChangeKind .
indexintegeryes Long-TermThe index of the column to change.

Returned Values

For the results, you can get the file path, the number of lines the CSV file contains, any headers and other such information. The table below describes what information would be available:

Table: UploadedFileSnapshot Datatype

ParameterTypeRequiredDefaultStabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results.
Table last updated: Sep 11, 2025
filterStringstring  Long-TermAny string on which to filter the data.
headers[string]yes Long-TermThe headers for the uploaded snapshot file.
limitintegeryes Long-TermThe file upload limit.
lines[string]yes Long-TermThe 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.
nameAndPathFileNameAndPathyes Long-TermThe name and path of the uploaded snapshot file. See FileNameAndPath.
offsetintegeryes Long-TermThis is the offset supplied to a file query. For a new or updated file, this is always 0.
resourcestringyes Short-TermThe resource identifier for the file.
totalLinesCountlongyes Long-TermThe total number of lines in the uploaded snapshot file.