1. Home
  2. Gateway
  3. HTTP API
  4. Subaccounts

Subaccounts

Benötigte Parameter

Parameter Beschreibung Mögliche Werte
action Bitte geben Sie hier die gewünschte Aktion an read – Subaccounts auslesen
create – Subaccount erstellen
delete – Subaccount löschen
update – Automatische Übertragung von Guthaben einstellen
transfer_credits – Guthaben von Haupt- auf Subaccount übertragen

Subaccounts auslesen

Beispiel

curl -X POST https://gateway.sms77.io/api/subaccounts?action=read \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL"

Sie erhalten ein JSON Array wie folgt:

[
    {
        "id": "1234567891",
        "username": null,
        "company": "Company 1",
        "balance": "36.8100",
        "total_usage": "0.3000",
        "auto_topup": {
            "threshold": "1",
            "amount": "5"
        },
        "contact": {
            "name": "John Doe",
            "email": "sms@acme-company1.com"
        }
    },
    {
        "id": "1234567892",
        "username": "push2app",
        "company": "Another Company",
        "balance": "120.4000",
        "total_usage": "0.0000",
        "auto_topup": {
            "threshold": null,
            "amount": null
        },
        "contact": {
            "name": "Donald Dummy",
            "email": "contact@another-acme-company.com"
        }
    }
]

Subaccount erstellen

Parameter Beschreibung Beispiel
name Name des Kontakts des Subaccounts John Doe
email Email Adresse des Kontakts des Subaccounts john.doe@acme-inc.com

Beispiel

curl -X POST https://gateway.sms77.io/api/subaccounts?action=create \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "{ \"name\": \"John Doe\", \"email\": \"john.doe@acme-inc.com\" }"

Sie erhalten im Erfolgsfall JSON Daten mit dem Subaccountobjekt zurück:

{
    "success": true,
    "error": null,
    "subaccount": {
        "id": "123456789",
        "username": null,
        "company": null,
        "balance": 0,
        "total_usage": 0,
        "auto_topup": {
            "threshold": 0,
            "amount": 0
        },
        "contact": {
            "name": "John Doe",
            "email": "john.doe@acme-inc.com"
        }
    }
}

Subaccount löschen

Zum Löschen eines Subaccounts geben Sie bitte die ID als Parameter an:

Parameter Beschreibung Beispiel
id ID des Subaccounts 123456789

Beispiel

curl -X POST https://gateway.sms77.io/api/subaccounts?action=delete \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "{ \"id\": \"123456789\" }"

Im Falle eines Fehlers erhalten Sie die Fehlermeldung, ansonsten Daten wie folgt:

{
    "success": true,
    "error": null
}

Guthaben übertragen

Parameter Beschreibung Beispiel
id ID des Subaccounts 123456789
amount Zu übertragendes Guthaben 12.00

Beispiel

curl -X POST https://gateway.sms77.io/api/subaccounts?action=transfer_credits \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "{ \"id\": \"123456789\", \"amount\": 12.00 }"

Im Falle eines Fehlers erhalten Sie die Fehlermeldung, ansonsten Daten wie folgt:

{
    "success": true,
    "error": null
}

Änderung der automatischen Aufladung des Subaccounts

Parameter Beschreibung Beispiel
id ID des Subaccounts 123456789
threshold Guthabenschwelle, unterhalb welcher Guthaben übertragen werden soll 20.00
amount Zu übertragendes Guthaben 50.00

Beispiel

curl -X POST https://gateway.sms77.io/api/subaccounts?action=update \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "{ \"id\": \"123456789\", \"threshold\": 20.00, \"amount\": 50.00 }"

Im Falle eines Fehlers erhalten Sie die Fehlermeldung, ansonsten Daten wie folgt:

{
    "success": true,
    "error": null
}