The service enables you to perform an import of recipients into the system.
The result of the service is the unique import id.
Java Code:
//get a reference to the service InwiseWebServices ws = new InwiseWebServices();
InwiseWebServicesSoap inwiseWebServicesSoap = ws.getInwiseWebServicesSoap();
//fill the security header
HeaderHandler hh = new HeaderHandler("myusername", "myPassword");
hh.setHeader(inwiseWebServicesSoap);
//the recipient's data should be in the format of csv, you can either create them programatically or copy the source of a csv file
StringBuilder recipients = new StringBuilder();
recipients.append("myemail,first_name,last_name");//the column headers
recipients.append("\r\n");
for (int i = 0; i < 4; i++) {
//data is separated with ',', with new line after each row
recipients.append("mail" + i + "@mail.com,shlomo" + i + ",cohen" + i);
recipients.append("\r\n");
}
//set the mapping between the recipients data headers to the local fields on Inwise Application
inwise.ArrayOfFileImportMapping mapping = new ArrayOfFileImportMapping();
mapping.fileImportMapping = new ArrayList<FileImportMapping>();
FileImportMapping map0 = new FileImportMapping();
map0.setFileColumnName("myemail");//recipient data column name
map0.setLocalId(0);//mapping of the email column is always done to "0"
mapping.fileImportMapping.add(map0);
FileImportMapping map1 = new FileImportMapping();
map1.setFileColumnName("first_name");//recipient data column name
map1.setLocalId(1);//id of the field on Inwise Application
mapping.fileImportMapping.add(map1);
FileImportMapping map2 = new FileImportMapping();
map2.setFileColumnName("last_name");//recipient data column name
map2.setLocalId(3);//id of the field on Inwise Application
mapping.fileImportMapping.add(map2);
int targetGroupId = 19;//the id of the group to make the import to
Boolean update=false;
//the result is the unique id of the import
int importId = inwiseWebServicesSoap.recipientsRegularImport(recipients.toString(), mapping, targetGroupId,update);
C# Code:
//get a reference to the service
InwiseWebServices.InwiseWebServices ws = new InwiseWebServices.InwiseWebServices();
//fill the security header
InwiseWebServices.SecHeader header = new InwiseWebServices.SecHeader();
header.username = "username";
header.pass = "myPassword";
ws.SecHeaderValue = header;//set credentials
//the recipient's data should be in the format of csv, you can either create them programatically or copy the source of a csv file
StringBuilder recipients = new StringBuilder();
recipients.AppendLine("myemail,first_name,last_name");//the column headers
for (int i = 0; i < 4; i++)
{
//data is separated with ',', with new line after each row
recipients.AppendLine("mail" + i + "@mail.com,shlomo" + i + ",cohen" + i);
}
//set the mapping between the recipients data headers to the local fields on Inwise Application
InwiseWebServices.FileImportMapping[] mapping = new InwiseWebServices.FileImportMapping[3];
mapping[0] = new InwiseWebServices.FileImportMapping();
mapping[0].FileColumnName = "myemail";//recipient data column name
mapping[0].LocalId = 0;//mapping of the email column is always done to "0"
mapping[1] = new InwiseWebServices.FileImportMapping();
mapping[1].FileColumnName = "first_name";//recipient data column name
mapping[1].LocalId = 1;//id of the field on Inwise Application
mapping[2] = new InwiseWebServices.FileImportMapping();
mapping[2].FileColumnName = "last_name";//recipient data column name
mapping[2].LocalId = 3;//id of the field on Inwise Application
int targetGroupId = 19;//the id of the group to make the import to
bool update = false;//update existing recipients details
//the result is the unique id of the import
int importId = ws.Recipients_RegularImport(recipients.ToString(), mapping, targetGroupId,update);
VB Code:
'get a reference to the service
Dim ws As InwiseWebServices.InwiseWebServices = New InwiseWebServices.InwiseWebServices()
'fill the security header
Dim header As InwiseWebServices.SecHeader = New InwiseWebServices.SecHeader()
header.username = "username"
header.pass = "myPassword"
ws.SecHeaderValue = header 'set credentials
'the recipient's data should be in the format of csv, you can either create them programatically or copy the source of a csv file
Dim recipients As StringBuilder = New StringBuilder()
recipients.AppendLine("myemail,first_name,last_name") 'the column headers
Dim i As Integer
For i = 0 To 4 - 1 Step i + 1
'data is separated with ',', with new line after each row
recipients.AppendLine("mail" & i & "@mail.com,shlomo" & i & ",cohen" & i)
Next
'set the mapping between the recipients data headers to the local fields on Inwise Application
Dim mapping() As InwiseWebServices.FileImportMapping = New InwiseWebServices.FileImportMapping(3) {}
mapping(0) = New InwiseWebServices.FileImportMapping()
mapping(0).FileColumnName = "myemail" 'recipient data column name
mapping(0).LocalId = 0 'mapping of the email column is always done to "0"
mapping(1) = New InwiseWebServices.FileImportMapping()
mapping(1).FileColumnName = "first_name" 'recipient data column name
mapping(1).LocalId = 1 'id of the field on Inwise Application
mapping(2) = New InwiseWebServices.FileImportMapping()
mapping(2).FileColumnName = "last_name" 'recipient data column name
mapping(2).LocalId = 3 'id of the field on Inwise Application
Dim targetGroupId As Integer = 19 'the id of the group to make the import to
Dim update As Boolean = False 'update existing recipients details
'the result is the unique id of the import
Dim importId As Integer = ws.Recipients_RegularImport(recipients.ToString(), mapping, targetGroupId,update)