Jobs

Preview a mutation

POST
Preview the results of a mutation

Request

This endpoint expects an object.
sheetId
stringRequired
Sheet ID
mutateRecord
stringRequired
A JavaScript function that will be run on each record in the sheet, it should return a mutated record.
mutationId
stringOptional
If the mutation was generated through some sort of id-ed process, this links this job and that process.
snapshotLabel
stringOptional
If specified, a snapshot will be generated with this label
snapshotId
stringOptional
The generated snapshotId will be stored here
filter
enumOptional
Options to filter records
Allowed values: validerrorallnone
filterField
stringOptional
Use this to narrow the valid/error filter results to a specific field
searchValue
stringOptional
Search for the given value, returning matching rows. For exact matches, wrap the value in double quotes ("Bob"). To search for null values, send empty double quotes ("")
searchField
stringOptional
Use this to narrow the searchValue results to a specific field
q
stringOptional
ids
list of stringsOptional
The Record Ids param (ids) is a list of record ids that can be passed to several record endpoints allowing the user to identify specific records to INCLUDE in the query, or specific records to EXCLUDE, depending on whether or not filters are being applied. When passing a query param that filters the record dataset, such as 'searchValue', or a 'filter' of 'valid' | 'error' | 'all', the 'ids' param will EXCLUDE those records from the filtered results. For basic queries that do not filter the dataset, passing record ids in the 'ids' param will limit the dataset to INCLUDE just those specific records

Response

This endpoint returns an object
data
list of objects
List of DiffRecord objects
POST
$curl -X POST https://api.x.flatfile.com/v1/jobs/preview-mutation \
> -H "X-Disable-Hooks: true" \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "sheetId": "string",
> "mutateRecord": "string"
>}'
Response
1{
2 "data": [
3 {
4 "id": "string",
5 "values": {
6 "string": {
7 "layer": "string",
8 "messages": [
9 {
10 "type": "error",
11 "source": "required-constraint",
12 "message": "string"
13 }
14 ],
15 "metadata": {
16 "string": {}
17 },
18 "snapshotValue": "string",
19 "updatedAt": "2023-01-01T00:00:00Z",
20 "valid": true,
21 "value": "string"
22 }
23 },
24 "commitId": "string",
25 "config": {
26 "readonly": true,
27 "fields": {
28 "string": {
29 "readonly": true
30 }
31 }
32 },
33 "metadata": {
34 "string": {}
35 },
36 "valid": true,
37 "messages": [
38 {
39 "type": "error",
40 "source": "required-constraint",
41 "message": "string"
42 }
43 ],
44 "versionId": "string"
45 }
46 ]
47}