Skip to the content

DoRoutes API · version 1

Imports

GET/v1/admin/imports/templates/{file}

Download an import template

Needs the imports.run permission. customers.csv or jobs.csv; a heading for each field and two example rows.

Parameters

  • filestring, in the path, required

Response 200

The template.

Response 401 · Error

No tenant key, or no valid session.

  • errorobject, required
    • codestring, required

      A short machine-readable name, such as not_found.

    • messagestring, required

      What went wrong, for people.

  • request_idstring, required

    Matches the X-Request-ID response header.

Example response 401
{
  "error": {
    "code": "string",
    "message": "string"
  },
  "request_id": "string"
}

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

GET/v1/admin/imports

The firm's imports

Needs the imports.run permission. The 100 newest, newest first.

Response 200 · object

Done.

  • importsarray of Import, required
    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "imports": [
    {
      "id": 0,
      "kind": "customers",
      "status": "uploaded",
      "columns": [
        {
          "heading": "string",
          "samples": [
            "string"
          ],
          "suggested": "string"
        }
      ],
      "fields": [
        {
          "key": "string",
          "label": "string",
          "required": true
        }
      ],
      "matches": {},
      "date_format": "string",
      "rows": 0,
      "rows_done": 0,
      "counts": {},
      "failure": "string",
      "failed_in": "",
      "start_again": true,
      "created_by": 0,
      "created_at": "string",
      "finished_at": "string",
      "undo_until": "string",
      "undo_report": [
        {
          "kind": "job",
          "id": 0,
          "reason": "string"
        }
      ]
    }
  ]
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports

Upload a CSV file to import

Needs the imports.run permission. A CSV file of at most 5 MB and 5,000 rows, with a header row whose headings are all different; UTF-8, or Windows-1252 as Excel saves it. Blank rows are left out; rows keep their line in the file. The answer holds each column's heading, first three values and suggested field, and for jobs the date format its dates suggest (when they fit one format, or the firm's last format when they fit several and it is one of them).

Response 200 · object

Stored, status uploaded.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 400 · Error

The request is not valid.

Fields as in Download an import template

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

GET/v1/admin/imports/{id}

An import

Needs the imports.run permission.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

PUT/v1/admin/imports/{id}/matches

Match an uploaded import's columns and start checking it

Needs the imports.run permission. matches gives each heading the field it fills, or an empty string to leave the column out. Every required field must be matched (400 naming those that aren't), each field to one column. date_format is required for jobs and remembered as the firm's last; it is ignored for customers. 409 when the import isn't uploaded or another of the firm's imports is running.

Parameters

  • idstring, in the path, required

Request body · object

  • matchesobject, required
  • date_formatstring, required

    One of: DD/MM/YYYY MM/DD/YYYY YYYY-MM-DD DD-MM-YYYY DD.MM.YYYY

Example request
{
  "matches": {},
  "date_format": ""
}

Response 200 · object

Status checking.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 400 · Error

The request is not valid.

Fields as in Download an import template

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

GET/v1/admin/imports/{id}/rows

An import's rows

Needs the imports.run permission. 100 rows a page, in line order; with outcome, only those rows.

Parameters

  • idstring, in the path, required
  • outcomestring, in the query
  • pageinteger, in the query

Response 200 · object

Done.

  • rowsarray of ImportRow, required
    • lineinteger, required

      The row's line in the file.

    • valuesobject, required

      Each heading's value.

    • outcomestring, required

      One of: ready flagged problem already duplicate created skipped

    • reasonsarray of string, required
    • tickedboolean, required
Example response 200
{
  "rows": [
    {
      "line": 0,
      "values": {},
      "outcome": "",
      "reasons": [
        "string"
      ],
      "ticked": true
    }
  ]
}

Response 400 · Error

The request is not valid.

Fields as in Download an import template

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

PUT/v1/admin/imports/{id}/rows/{line}

Tick a possible duplicate

Needs the imports.run permission. Ticks or unticks a checked import's possible duplicate, by its line, to import it or not.

Parameters

  • idstring, in the path, required
  • linestring, in the path, required

Request body · object

  • tickedboolean, required
Example request
{
  "ticked": true
}

Response 200 · object

Done; the import with its counts.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 400 · Error

The request is not valid.

Fields as in Download an import template

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports/{id}/retry

Try a failed import again

Needs the imports.run permission. A failed import carries on from where it stopped; a failed undo only within 7 days of its start.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports/{id}/import

Import a checked import's rows

Needs the imports.run permission. Imports, in the background, the ready and flagged rows and the possible duplicates ticked; customers are never emailed. 409 when the import isn't checked or another of the firm's imports is running.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports/{id}/drop

Drop an import

Needs the imports.run permission. Drops an import that has saved nothing (uploaded, checked, or failed while checking) and deletes its rows. 409 otherwise.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports/{id}/undo

Undo an import

Needs the imports.run permission. Starts undoing an import imported in the last 7 days, or one that stopped while importing (status failed, failed_in importing); 409 otherwise, or while another import is running. Newest row first, it removes the jobs no one has planned, staffed, worked, invoiced or changed; deposit invoices with no other payment, credit note, pay link or accounting push; quotes left with no job or invoice and unchanged, with the addresses only they used; and customers left with no quote or invoice who haven't signed in or changed. What it keeps is listed in undo_report.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

POST/v1/admin/imports/{id}/start-again

Start a stopped import again

Needs the imports.run permission. Undoes, as the undo route does, what an import that stopped while importing made, then checks every row again from the first, to import once checked; start_again is true until the undo ends. 409 when the import didn't stop while importing, or while another import is running.

Parameters

  • idstring, in the path, required

Response 200 · object

Done.

  • importImport, required

    A CSV file of customers or jobs being imported, and how far it has gone.

    • idinteger (int64), required
    • kindstring, required

      One of: customers jobs

    • statusstring, required

      One of: uploaded checking checked importing imported dropped failed undoing undone

    • columnsarray of ImportColumn, required
      • headingstring, required

        A blank heading is named "Column N".

      • samplesarray of string or null, required
      • suggestedstring, required

        The field the heading suggests, or empty.

    • fieldsarray of ImportField, required

      The fields this kind of file's columns can be matched to, in the template's order.

      • keystring, required
      • labelstring, required
      • requiredboolean, required

        Must be matched to a column before checking.

    • matchesobject, required

      Each matched heading's field.

    • date_formatstring, required

      Suggested at upload, confirmed with the matches; empty for customers.

    • rowsinteger, required
    • rows_doneinteger, required
    • countsobject, required

      Rows by the check's outcome, and ticked, the possible duplicates ticked to import; once importing, also created and skipped. rows_done counts the stage running, from 0 for each; an undo starts at the rows that made nothing.

    • failurestring
    • failed_instring, required

      The stage a failed import stopped in; empty otherwise.

      One of: checking importing undoing

    • start_againboolean, required

      True while a stopped import is undone to be checked again.

    • created_byinteger (int64) or null, required
    • created_atstring, required

      UTC, YYYY-MM-DD HH:MM:SS.

    • finished_atstring

      UTC, YYYY-MM-DD HH:MM:SS; when the last stage ended. An import not imported 7 days after its upload is dropped; one that stopped while importing is then undone.

    • undo_untilstring

      UTC, YYYY-MM-DD HH:MM:SS; set once imported, or once an undo of a stopped import starts, 7 days on, and cleared once undone. Rows lose their values on importing and on an undo not started again.

    • undo_reportarray of object, required

      What the last undo kept, and why, as "Job 812 kept: planned on 14 November".

      • kindstring, required

        One of: job invoice quote customer

      • idinteger (int64), required
      • reasonstring, required
Example response 200
{
  "import": {
    "id": 0,
    "kind": "customers",
    "status": "uploaded",
    "columns": [
      {
        "heading": "string",
        "samples": [
          "string"
        ],
        "suggested": "string"
      }
    ],
    "fields": [
      {
        "key": "string",
        "label": "string",
        "required": true
      }
    ],
    "matches": {},
    "date_format": "string",
    "rows": 0,
    "rows_done": 0,
    "counts": {},
    "failure": "string",
    "failed_in": "",
    "start_again": true,
    "created_by": 0,
    "created_at": "string",
    "finished_at": "string",
    "undo_until": "string",
    "undo_report": [
      {
        "kind": "job",
        "id": 0,
        "reason": "string"
      }
    ]
  }
}

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 409 · Error

It clashes with what is stored.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template

GET/v1/admin/imports/{id}/problems.csv

Download an import's problem rows

Needs the imports.run permission. The problem rows with the file's columns and a problem column giving the reasons.

Parameters

  • idstring, in the path, required

Response 200

The problem rows.

Response 401 · Error

No tenant key, or no valid session.

Fields as in Download an import template

Response 403 · Error

The session may not do this.

Fields as in Download an import template

Response 404 · Error

Not found, or not yours.

Fields as in Download an import template

Response 500 · Error

Something failed on our side.

Fields as in Download an import template