Import
Import your customer details into your SendMode account.
Available HTTP Methods: POST

Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| importdata | JSON | Data of the customer to import in JSON format. | Yes |
| group | string | Group to add the customer into. | No |

Importdata JSON
| Parameter | Type | Description | Required |
|---|---|---|---|
| mobilenumber | string | The customers mobile number. | Yes |
| firstname | string | The customers first name. | No |
| surname | string | The customers surname. | No |
| address | string | The customers address. | No |
| town | string | The customers address town. | No |
| county | string | The customers address county. | No |
| string | The customers email address. | No | |
| custom1 | string | The customers custom1 field. | No |
| custom2 | string | The customers custom2 field. | No |
| businessname | string | The customers business name. | No |
| dateofbirth | string | The customers date of birth in format dd/mm/yyyy | No |
Example importdata JSON
{
"mobilenumber":"0870000000",
"firstname":"Hello",
"surname":"World"
}
Code Example
C#
string customer = new JavaScriptSerializer().Serialize(new
{
mobilenumber = "0870000000",
firstname = "Hello"
}
);
string group = "Hello World";
using (WebClient client = new WebClient())
{
client.Headers.Add("Authorization", "YOUR_ACCESS_KEY");
byte[] response = client.UploadValues("https://rest.sendmode.com/v2/import", new NameValueCollection()
{
{ "importdata", customer},
{ "group", group},
});
string result = System.Text.Encoding.UTF8.GetString(response);
}
php
$arr = array('mobilenumber' => '0870000000', 'firstname' => 'Hello');
$url = 'https://rest.sendmode.com/v2/import';
$data = array('importdata' => json_encode($arr));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n" .
"Authorization: YOUR_ACCESS_KEY\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
Java
HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost("https://rest.sendmode.com/v2/import");
httppost.setHeader(HttpHeaders.AUTHORIZATION, YOUR_ACCESS_KEY);
String json = "{\"firstname\" : \"Hello\", \"mobilenumber\" : \"0870000000\"}";
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("importdata", json));
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();

Response
{
"status":"OK",
"statusCode":0,
"acceptedDateTime":"2017-08-28T13:42:02.1757174+01:00",
"group":"HELLO WORLD",
"importdata":{
"mobilenumber":"0870000000",
"firstname":"Hello World",
"surname":null,
"address":null,
"town":null,
"county":null,
"email":null,
"custom1":null,
"custom2":null,
"businessname":null,
"dateofbirth":null
}
}