- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Problems starting CSV Import via WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 02:36 AM
Hi @all,
I´m trying to start a CSV import via the WAPI. Unfortunately I´m getting the following error message
"Error": "AdmConDataError: None (IBDataError: IB.Data:CSV Import file is not valid. First line of the file must be either a valid version number or a valid header line.
This is my import file. It is encoded in us-ascii which should be correct.
header-fixedaddress,IMPORT-ACTION,ip_address*,mac_address,match_option,ms_server
fixedaddress,I,10.54.0.3,12:34:56:78:90:12,MAC_ADDRESS,
fixedaddress,I,10.54.0.4,22:34:56:78:90:12,MAC_ADDRESS,
Importing this file via the WebGui works perfect.
Here are my commands to start the upload
curl -k -u XXX:XXX -H content-type:application/json -X POST 'https://1.2.3.4/wapi/v2.7/fileop?_function=uploadinit
curl -k -u XXX:XXX -H content-type:multipart-formdata https://1.2.3.4/http_direct_file_io/req_id-UPLOAD-1056/import_file -F file=@test8-UTF.csv
curl -k -u XXX:XXX -H content-type:application/json -X POST 'https://1.2.3.4/wapi/v2.7/fileop?_function=csv_import' -d '{"action":"START","on_error":"CONTINUE","update_method":"OVERRIDE","separator":"COMMA","operation":"CUSTOM","token":<TOKEN>"}'
I shortend the last command because the token is less relevant.
Do you have any idea why I´m getting this error message?
kind regards
Volker
Re: Problems starting CSV Import via WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 07:25 AM
The CSV exampe is formatted as a custom import type. But you're specifying an override import. The API guide doesn't offer CUSTOM as an import type for API.
You could try changing the import type from OVERRIDE to CUSTOM but that may not actually work.
... "update_method":"OVERRIDE" ...
Probably you need to change the CSV file to be a traditional import type, by removing the IMPORT-ACTION column.
Re: Problems starting CSV Import via WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 11:19 PM
Thanks for your response.
You are right. Unfortunately only "Merge" and "Override" are supported values for "update_method". So I removed the column "IMPORT-ACTION". But I still get the same error message.
curl -k -u XXX:XXX -H 'content-type:application/json' -X POST "https://1.2.3.4/wapi/v2.7/fileop?_function=csv_import" -d '{"action":"START","on_error":"CONTINUE","update_method":"OVERRIDE","separator":"COMMA","operation":"INSERT","token":"'"$TOKEN"'"}'
This is my new import file:
header-fixedaddress,ip_address*,mac_address,match_option,ms_server
fixedaddress,10.54.0.3,12:34:56:78:90:12,MAC_ADDRESS,
fixedaddress,10.54.0.4,22:34:56:78:90:12,MAC_ADDRESS,
Any other idea?