GoliathDevelopersGet an API key
Reference/Contact Importsgenerated from the gateway manifest

getContactImport

The status of an import.

POST/api/v1/callREADreadruns as the key's owner
View as Markdown

The status of an import: status (CREATED and AUTHORING_TRANSFORMER = not confirmed yet, PENDING_PROCESSING and PROCESSING = importing, COMPLETED, FAILED, NOT_ENOUGH_BALANCE), totalRows, the contacts produced so far (producedRecordsCount), a best-effort estimatedRemainingTimeInSeconds (it runs high early in an import, so never promise a time from it: the chat that started the import is told when it finishes), the upload’s own list (contactTag, named for the file; not the list the person chose), and the results report: created, matched (an existing contact updated, or one an earlier row of this same file made), duplicateRowCount (rows that repeat an earlier row of this file), mergedAfterImportCount (the duplicate rows whose new contact was merged into an earlier row’s after the import; the rest of the duplicates count as matched, so contacts they already had = matched - (duplicateRowCount - mergedAfterImportCount)), restored (an archived match brought back), skipped and failed rows, and processedRowCount. One read answers "how is it going". For an import this chat started, the chat is told when it finishes, so a code task never polls it; for one started elsewhere (Files, another chat), poll every 10 to 30 seconds.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getContactImport",
    "variables": {
      "fileProcessingTaskId": "<fileProcessingTaskId>"
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.contactImports.getContactImport({
  fileProcessingTaskId: '<fileProcessingTaskId>'
})
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    operationId: 'getContactImport',
    variables: {
      fileProcessingTaskId: '<fileProcessingTaskId>'
    }
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

fileProcessingTaskIdID!required

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "fileProcessingTaskQuery": {
      "fileProcessingTask": {
        "id": "<ID>",
        "status": "CREATED",
        "totalRows": 0,
        "producedRecordsCount": 0,
        "estimatedRemainingTimeInSeconds": 0,
        "contactTag": {
          "name": "…"
        }
      },
      "uploadReport": {
        "createdCount": 0,
        "matchedCount": 0,
        "restoredCount": 0,
        "skippedCount": 0,
        "failedCount": 0,
        "mergedAfterImportCount": 0,
        "duplicateRowCount": 0,
        "processedRowCount": 0
      }
    }
  }
}

Errors

Behaviour

A read. It rejects an Idempotency-Key header with 400 bad_request.