Add rows to a draft
Adds up to 500 rows to a drafting or checked draft, returning a checked draft to drafting. Set start to 2 initially (row 1 is the header), then to the next row after the last sent; repeating start replaces those rows. last: true removes later stored rows, or all rows from start if none are sent, so resending fewer rows from start 2 shrinks the draft. Rows must be consecutive (409 ROWS_OUT_OF_ORDER); drafts allow up to 50,000 rows (422 CAP_REACHED) and request bodies up to 256 KB. Send fewer rows if needed to fit.
Required access
- API key
- Any ofChange the catalogCreate and change customersManage purchase ordersCreate and change quotesChange ordersWork warranty claimspermissions
- Request limit
- Counts as 2 requests. Each key has a capacity of 15, restored at 0.6 a second.
Idempotent-Replayed: true. Responses are saved for 24 hours.Headers
Bearer and your key, opk_….
Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.
application/json. A body is at most 256 KB.
Parameters
The draft’s id, as POST /imports answered it.
Body
JSONtrue, with last: true: check the draft once these rows are in (it answers checking). Left out: check it with POST /imports/{id}/check.
The rows as CSV text, in place of rows: a header row, then up to 500 rows. Each call’s text starts with the header again. Headers match as on an upload (header, key or alias, ignoring case and spaces); a column the kind doesn’t use is named in a note.
true: these are all the draft’s rows from start on, and every row stored after them is dropped (with no rows, every row from start). Left out or false: the rows after them stay.
1–500 rows, in order (none only with last: true). Send this or csv.
The row number of the first row: 2 on the first call (row 1 is the header), then one past the last row sent. The same start again replaces those rows. With csv, the text’s first line under its header is this row.
Returns
OK: batch_id, counts, created_at, created_by, existing_choice, expires_at, failure, id, import_mode, imported_at and more
Errors
Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.
The request isn’t valid (see error.code), or the API version isn’t supported.
No valid access token or API key.
The store’s subscription isn’t active.
Not allowed: the API is off for this store, or the caller lacks the scope or permission.
Not found, or not visible to this caller.
Wrong method for this path; Allow lists every method the path takes.
The request body didn’t arrive in time.
The same Idempotency-Key is still being processed (REQUEST_IN_PROGRESS), its outcome is unknown (OUTCOME_UNKNOWN: check the record), or the record changed since it was read.
The request body is too large.
The request is valid JSON but can’t be done (a rule of the store refuses it), or the Idempotency-Key was used with a different body.
The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.
Over a rate limit; wait Retry-After seconds.
Something went wrong on our side. A write may have partly happened: check the record before retrying it.
Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.