API REST – Contact bulk load (1.0)

Download OpenAPI specification:Download

The Contact bulk load is a REST webservice that is used for importing a large number of contacts to a specific database table that should be already created inside the DANAconnect platform.

Considerations prior to using the API:

  • The company that is going to use the API must have a valid username and password in the DANAConnect platform.
  • For security reasons, the user who is going to use the API must have a special permission. Your DANAConnect Account Manager must ensure that this permission is enabled.
  • You must have already located the parameters of the database where you need to import the contacts in the DANAConnect platform, such as the parameter tableCode. The parameter tableCode: corresponds to the logical code of the database that should have been previously created in the DANAConnect platform where you wish to import the data. This code can be found by entering the Contact Manager module inside the DANAConnect platform and looking for the database to be used in the database list.
    See how to find the tableCode in the section Getting started.

Authentication

basicAuth

The API uses the same user credential system that is used to enter the DANAConnect platform.
The method used for all DANAConnect APIs is HTTP BASIC AUTH, which is based on login and password authentication.
Login: The login consists of the username concatenated with an @ and followed by the company code.
Login example:

  • Platform username: myuser
  • Company code for the platform: mycompanycode
  • Login for DANAConnect API: myuser@mycompanycode
  • Password: The password you should use for API authentication is the same as you use for login to the DANAConnect platform
Security Scheme Type HTTP
HTTP Authorization Scheme basic

Contact Bulk Load

Operations involved in loading contacts from a file to a table

Import contacts from a file to the specified contact list

This service will import contacts from a file that will be inserted to the specified table. Where tableCode is the identifier of a previously created contact list. This code can be found by clicking the desire contact list inside Contact Manager Module

Authorizations:
path Parameters
tableCode
required
string non-empty

Contact List Identifier found in Contact Manager Module

Request Body schema: multipart/form-data
separator
string
Default: ","

Character that separates values inside the file

delimiter
string

Character that identifies where a value starts and where it ends

includeHeaders
boolean
Default: false

Set to true if the first record in the file correspond to the column name, otherwise false

operationType
string
Default: "INSALL"

UPDINS: Insert new records and update existing ones. INSALL: Insert all records. UPALL: Update all records. INSNEW: Insert new records only. keyField value will be used to know if the record already exist in case it needs to be updated

encodingType
string

File encoding type. Usually UTF-8

keyField
string Nullable

This fields will be used to identify unique records in case an update is requested. If more than one field is needed, they should be separated by a semicolon(;)

fieldsCode
string non-empty

Column names separated by a semicolon(;). Should match the order presented in the file

strict
boolean
Default: true

If set to true, no values will be inserted if a problem was found. Otherwise valid records will be inserted when possible

file
string <binary> non-empty

The file that will be sent has to be selected here

callbackURL
string <url>
Default: ""

If specified, this URL will be called by the server with information about the request status. See FileNotify schema in the Callback Section.


POST JSON EXAMPLE:

{"fileName":"s3://contactsfile/3233/Contacts.csv", 
"fileSize":2910575, 
"logID":9876, 
"result":"FINISHED", 
"idCompany":"CompanyCode", 
"idWebDb":987, 
"lineCount":7832, 
"movedFile":"processed/Log9876-webdb987"}

Responses

Callbacks

Request samples

curl -i -X POST \
-u <username@companycode>:<password>  \
https://ws.danaconnect.com/api/contacts/rest/webdb/table/:tableCode \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-F 'delimiter="' \
-F 'encodingType=UTF-8'  \
-F 'includeHeaders=false'  \
-F 'operationType=INSALL'  \
-F 'separator=,'  \
-F 'strict=true'  \
-F 'fieldsCode="TEST_NAME;TEST_LASTNAME;TEST_PHONE;TEST_EMAIL"'  \
-F file=@/path/to/file/testFile.csv 

Response samples

Content type
application/json
Example

Successful Response without any warnings

{
  • "fields": [
    ],
  • "fileName": "testFile.csv",
  • "idCompany": "YourCompanyCode",
  • "includeHeaders": false,
  • "separator": ",",
  • "status": true,
  • "tableCode": "TestTableCode"
}

Callback payload samples

Callback
POST: Import operation completed
Content type
application/json

POST sent to the callback url if it was specified

{
  • "fileName": "s3://contactsfile/3233/Contacts.csv",
  • "fileSize": 2910575,
  • "logID": 9876,
  • "result": "FINISHED",
  • "idCompany": "CompanyCode",
  • "idWebDb": 987,
  • "lineCount": 7832,
  • "movedFile": "processed/Log9876-webdb987"
}