Store an import cleaning plan

Validates a cleaning plan for an import upload exactly as the import assistant does and stores it as pending: operations in order, each one of rename_header (from, to), normalize_date (column, source_format), normalize_number (column, decimal, thousands), replace_value (column, from, to), map_enum (column, mapping), normalize_boolean (column, true_values, false_values) or trim_whitespace (columns, * for every column), with an optional row_filter, every column checked against the file's own headers. Answers 201 with plan: plan_id, status pending, applied false, the upload it belongs to (source_upload_id, source_hash, source_revision, entity, filename, headers, row_count), the operations and the changes in words. Nothing is applied or imported. Only a person applies a cleaning plan, from the cleaned-file card in a Cybooks AI import conversation; plans stored through the API are not yet listed in the app, so show the person the changes. 422 validation_failed for a malformed plan (each operations item an object whose op is one of the seven), 422 transformation_plan_invalid (error.fields.operations, naming the operation by its position) for a plan the assistant would refuse; 409 import_upload_changed when source_hash or source_revision does not match this upload, 409 import_upload_not_ready while the file is still being stored, 409 import_upload_superseded (with current_upload_id) when a newer revision of the file exists, 409 import_upload_unavailable once the upload was used, removed or could not be stored; 503 import_manager_unavailable while the import tables are upgraded. Requires an Idempotency-Key: the same key and request replays the first plan. Requires the imports:write OAuth scope with manage_imports, the entity's create and update permissions and the imports plan feature.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
required
Body Params

Fields accepted to store an import cleaning plan. The schema identifies required and optional values.

A cleaning plan for an import upload: the operations, in order. Each
operation's own fields are checked against the file's headers as the
import assistant checks them.

string
length between 64 and 64

The upload's source_hash as you read it; refused when it does not match this upload

integer
≥ 1

The upload's revision as you read it; refused when it does not match this upload

operations
array
required
length ≥ 1

The cleaning operations, in order, each an object with its op and that operation's own fields: rename_header (from, to), normalize_date (column, source_format), normalize_number (column, decimal, thousands), replace_value (column, from, to, optional row_filter, a column-to-value object), map_enum (column, mapping, a value-to-value object), normalize_boolean (column, true_values, false_values) or trim_whitespace (columns, * for every column)

operations*
Headers
string
required
length ≤ 191

Required unique key whose request hash and terminal response are stored durably for 24 hours.

Responses

Language
Credentials
OAuth2
Missing 1 required scope
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*