Employee import
Create many employees at once from a spreadsheet, through a background import process.
Employee import creates many employees at once from a spreadsheet, rather than one call per person.
Convert the spreadsheet first with data/spreadsheet/parse, which stores it as a tab-separated file and returns its name. Pass that name to employee/import/start as filename, follow the process with read or list, and collect the rows that failed validation with download_failed.
API actions
API base path: /employee/import.
Operations that list no errors of their own return only the general error codes.
Create the TSV file first with /data/spreadsheet/parse, which returns its name as file_id. Pass that name to start as filename.
Available fields for headers:
first_namemiddle_namelast_nameemailphonedriver_license_numberdriver_license_catsdriver_license_issue_datedriver_license_valid_tillhardware_keyaddresslatlngradiuspersonnel_numberssntracker_labeltagsundefined(if a meaning of a field is not known)
Required sub-user rights: employee_update.
Start the background process that imports employees from a preloaded TSV file, and return the process ID.
Create the file first with data/spreadsheet/parse, which converts a spreadsheet to TSV and returns its name as file_id. Pass that name here as filename.
Requires the employee_update right.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
Name of the server-side TSV file, as returned by data/spreadsheet/parse in its file_id. Must not be empty.
What each column of the file holds, in order. Must not be empty. Use undefined for a column whose meaning is not known.
Optional. Display labels for the columns. Must be the same length as headers.
The started import
true if request finished successfully.
trueID of the created import process.
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 233: the preloaded file was not found. Error 234: the file is not a TSV.
Error 247: an identical import already exists for the same file.
Error 15: too many requests, when too many imports are already in progress.
Error response object
POST /v2/employee/import/start HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 62
{
"filename": "text",
"headers": [
"text"
],
"user_headers": [
"text"
]
}{
"success": true,
"id": 1
}Errors
These errors come in addition to the general error codes:
15 - Too many requests (rate limit exceeded) - if too many imports in progress
233 - No data file
234 - Invalid data format
247 - Entity already exists - there is another identical import with the same file
Return one employee import process by ID, including its progress.
The import process object is the same shape every import family returns, differing only in type, which is employee here.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the import process.
The import process
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/employee/import/read HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 16
{
"process_id": 1
}{
"success": true,
"value": {
"id": 1,
"user_id": 1,
"subuser_id": 1,
"created": "text",
"type": "place",
"params": {
"headers": [
"text"
],
"user_headers": [
"text"
]
},
"filename": "text",
"status": "created",
"status_change_date": "text",
"progress": {
"imported": 1,
"failed": 1,
"percent": null,
"processed_lines": 1,
"warnings": [
{
"line": 1,
"message": "text"
}
],
"errors": [
{
"line": 1,
"message": "text"
}
]
}
}
}Errors
These errors come in addition to the general error codes:
201 - Not found in database (if import is not found)
List the current user's unfinished employee import processes.
Callable with an empty body.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
Unfinished import processes
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/employee/import/list HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Accept: */*
{
"success": true,
"list": [
{
"id": 1,
"user_id": 1,
"subuser_id": 1,
"created": "text",
"type": "place",
"params": {
"headers": [
"text"
],
"user_headers": [
"text"
]
},
"filename": "text",
"status": "created",
"status_change_date": "text",
"progress": {
"imported": 1,
"failed": 1,
"percent": null,
"processed_lines": 1,
"warnings": [
{
"line": 1,
"message": "text"
}
],
"errors": [
{
"line": 1,
"message": "text"
}
]
}
}
]
}Return a file of the rows that failed validation, so they can be corrected and imported again.
The response is the file itself, not a JSON envelope.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the import process.
The failed rows as a file
Bad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 204: the file of failed rows was not found.
Error response object
POST /v2/employee/import/download_failed HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 16
{
"process_id": 1
}binaryErrors
These errors come in addition to the general error codes:
201 - Not found in database (if import is not found)
204 - Entity not found (if file is not found)
Last updated
Was this helpful?