Die REST-API ist verfügbar, um Nachrichten zu senden
In wenigen Minuten bereit zum Testen der REST SMS Schnittstelle in 3 Schritten: Code kopieren ► Registrieren ► API Aktivieren & konfigurieren ► Testen
Code in der passenden Programmiersprache kopieren
c#
conststring username = "foo";
conststring password = "bar";
var authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
var client = new HttpClient {
BaseAddress = new Uri("https://rest.ecall.ch/api/"),
DefaultRequestHeaders = {
Authorization = new AuthenticationHeaderValue("Basic", authorization)
},
};
const string message = @"
{
""channel"": ""sms"",
""from"": ""0041XXXXXXXXX"",
""to"": ""0041XXXXXXXXX"",
""content"": {
""type"": ""Text"",
""text"": ""Hello eCall World""
}
}";
await client.PostAsync("message", new StringContent(message, Encoding.UTF8, "application/json"));
VB
Const username = "foo"
Const password = "bar"
Dim authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))
Dim client = New HttpClient()
client.BaseAddress = New Uri("https://rest.ecall.ch/api/")
client.DefaultRequestHeaders.Authorization = New
AuthenticationHeaderValue("Basic", authorization)
Const message = "
{
""channel"": ""sms"",
""from"": ""0041XXXXXXXXX"",
""to"": ""0041XXXXXXXXX"",
""content"": {
""type"": ""Text"",
""text"": ""Hello eCall World""
}
}"
Await client.PostAsync("message", new StringContent(message, Encoding.UTF8,"application/json"))
cURL
curl -X POST https://rest.ecall.ch/api/message \
-H "Content-Type: application/json" \
-u "username:password" \
-d \
"{
\"channel\": \"sms\",
\"from\": \"0041XXXXXXX\",
\"to\": \"0041XXXXXXX \",
\"content\": {
\"type\": \"Text\",
\"text\": \"Hello eCall World\"
}
}"
Java
String url = "https://rest.ecall.ch/api/message";
String username = "foo";
String password = "bar";
String pair = username + ":" + password;
String authorization = Base64.getEncoder().encodeToString(pair.getBytes());
String data = """
{
"channel": "sms",
"from": "0041XXXXXXX ",
"to": "0041XXXXXXX ",
"content": {
"type": "Text",
"text":"Hello eCall World"
}
}
""";
HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Basic " + authorization)
.POST(HttpRequest.BodyPublishers.ofString(data))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
PowerShell
$url = 'https://rest.ecall.ch/api/message'
$username = 'foo'
$password = 'bar'
$authorization =[System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($username):$($password)"))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Basic $authorization")
$body = "{
`n `"channel`": `"sms`",
`n `"from`": `"0041XXXXXXX `",
`n `"to`": `"0041XXXXXXX `",
`n `"content`": {
`n `"type`": `"Text`",
`n `"text`":`"Hello eCall World`"
`n }
`n}"
Invoke-RestMethod -uri $url -Method 'POST' -Headers $headers -Body $body | ConvertTo-Json
Registrieren & anmelden
Um die Schnittstelle zu testen, ist ein Konto erforderlich. Dieses ist kostenlos.
Ihr Passwort erhalten Sie aus Sicherheitsgründen per SMS.
Aktivieren & konfigurieren
Nach der Registrierung können Sie in Ihrem Konto im Bereich „Schnittstellen“ die API selbst aktivieren und weitere Konfigurationen vornehmen .
Benötigen Sie mehr als 40 SMS zum Testen? Kein Problem. Kontaktieren Sie einen eCall-Experten
Möchten Sie mehr über die REST API erfahren? Gerne beraten wir Sie persönlich?