THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

Problems starting CSV Import via WAPI

Techie
Posts: 6
5164     0

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

VJ

Re: Problems starting CSV Import via WAPI

Moderator
Moderator
Posts: 315
5164     0

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

Techie
Posts: 6
5164     0

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?

 

 

VJ
Showing results for 
Search instead for 
Did you mean: 

Recommended for You