Skip to main content

Export management

Export management

The export module allows you to export a list of emails with their fields. And to define the exported population, you use a target created before.

info

Vous trouverez la documentation pour créer une cible ici.

To create a subscriber export, you must use the POST api/{idsite}/exports/subscribers call.

The parameters to specify in the url are the following:

NameDescriptionTypeAdditional information
idsiteMindBaz site identifierIntegerMandatory

In the query body, the parameters to be passed in the form "application/json, text/json " are as follows:

NameDescriptionTypeAdditional information
compressIndicates how to compress the data.ECompressionModeNone
filenameIndicates the name of the file to be exported.
A suffix is added automatically at the end of the file name in the form yyyyMMddHHmmss. The csv extension is added automatically.
The final file name will therefore be in the form "myFilename_yyyyMMddHHmmss.csv".You can also export to a sub-directory by specifying it in filename. e.g. "myDirectory\myFilename". Attention, the directory must already be created.
Character stringNone
idRepositoryId of an external sftp to mindbaz to drop the file. To get the list of repositories, you can call GET /api/{idsite}/exports/repositories. To add more repositories, you need to make a request to customer service.Integernull for the default storage.
idsFieldsIndicates the list of fields to insert in the export.Collection of StringMandatory
idTargetIndicates the target identifier.Integer numberMandatory
quantityIndicates the number of rows to export, 0=all.IntegerNone
Indicates how to export the list type fields.ETypeListMandatory
encodingIndicates how data is encoded.EEncodingTypeMandatory
idsEncodeFieldsIndicates the list of fields to be encoded in a column (placed in the last position of the file). The provided fields will be concatenated and then hashed according to the algorithm defined in the encoding parameter.
e.g. if I want to have a column with an md5 hash corresponding to email+lastname+firstname, I must set idsEncodeFields = [1,14,15] and encoding="MD5".
the new column will have as its name the type used for the hash (MD5 in the example).
Attention, the order of the fields is important!
Collection of StringNone

The type ECompressionMode is of type Enum:

NameValueDescription
GZip1GZip compression
Zip2Zip compression

The EEncodingType is of type Enum:

NameValueDescription
None0No encoding, plain text
MD51Hash MD5
SHA12Hash SHA1
SHA2_2563Hash SHA256
SHA2_5124Hash SHA512

The ETypeList is of type Enum:

NameValue
ID0
VALUE1
{
"idTarget": 1161,
"idsFields": ["0", "1"],
"filename": "test_export_api",
"quantity": 0,
"typeList": "ID",
"compress": "GZip",
"encoding": "None",
"idRepository": 0
}

On return call I get the information of the newly created export:

{
"success": true,
"data": true,
"error": null,
"typeName": "Boolean"
}

Codeline

string token = ""; //Value of the token retrieved for authentication
string idSite = ""; //Value of the site id
var client = new RestClient("https://api.mindbaz.com/api/" + idSite + "/exports/subscribers");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer " + token);
var body = @"{""idTarget"": 1161,""idsFields"": [""0"",""1""],""filename"": ""test_export_api"",""quantity": 0,""typeList": ""ID",""compress": ""GZip"",""encoding": ""None"",""idRepository"": 0 }";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);