Imports¶
-
POST
/api/v1/lists/
(int: list_id)/imports
¶ Import an uploaded CSV as subscribers of the specified list.
Parameters: - list_id (int) – list’s unique identifier
Form Parameters: - file – the CSV subscriber file
- encoding – the file encoding, detected automatically if not specified
- delimiter – column delimiter, detected automatically if not specified
- has_header – whether or not the file has an header, detected automatically if not specified
- ignore_invalid_fields – whether or not rows with invalid fields should be considered or not
- date_format – the strptime format used to express dates
- fields – array mapping column indexes to fields
If the
fields
parameter is not specified thefile
must start with an header row mapping the file columns to the subscriber list fields and thehas_header
parameter must be set totrue
.subscribers.csv¶ email first_name gender language alice@domain.com Alice f fr bob@example.com Bob m en Request:
POST /api/v1/lists/1/imports HTTP/1.1 Host: account.emailicious.com Accept: application/json Content-Type: multipart/form-data; boundary=------------------------aefc77a7a0e120e9
Response:
HTTP/1.1 201 CREATED Vary: Accept Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json { "id": 1, "file": "subscribers.csv", "encoding": "utf-8", "delimiter": ",", "has_header": true, "ignore_invalid_fields": true, "date_format": "%d-%m-%Y", "fields": [ "email", "first_name", "gender", "language" ] }
Status Codes: - 201 Created – the import was created successfully
- 400 Bad Request – invalid import data
- 404 Not Found – no subscriber list match the specified
list_id