Subaccounts verwalten

Nutzen Sie unsere API, um Subaccounts einfach zu handhaben: Erstellen, löschen, Infos abrufen und Guthaben überweisen. Ideal für alle, die ihre Account-Struktur übersichtlich und effizient verwalten möchten.


GET/api/subaccounts?action=read

Subaccounts auflisten

Fragen Sie eine Liste aller Subaccounts eines Accounts ab.

Parameter

  • Name
    id
    Type
    integer
    Optional
    Optional
    Description

    Die ID eines Subaccounts. Damit erhalten Sie nur die Daten zu einem spezifischen Subaccount.

Anfrage

GET
/api/subaccounts
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -H "Accept: application/json"

Antwort

[
  {
      "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"
      }
  },
  {
    "id": 12345
    // ...
  }
]

POST/api/subaccounts?action=create

Subaccount erstellen

Erstellen Sie über die API einen Subaccount.

Parameter

  • Name
    name
    Type
    string
    Description

    Vollständiger Vor- und Nachname des Besitzers des Accounts.

  • Name
    email
    Type
    string
    Description

    E-Mail Adresse des Accounts.

Anfrage

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

Antwort im Erfolgsfall

{
  "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"
      }
  }
}

Antwort bei Fehler

{
  "success": false,
  "error": "Invalid request"
}

POST/api/subaccounts?action=update

Automatische Guthabenübertragung

Mit dieser API können Sie die die automatische Guthabenübertragung für einen Subaccount konfigurierern. Diese kann Guthaben bei unterschreiten einer festgelegtenten Schwelle vom Hauptaccount auf den Subaccount übertragen. Zum Deaktivieren setzen Sie amount einfach auf 0.

Parameter

  • Name
    id
    Type
    integer
    Description

    Die ID des Subaccounts.

  • Name
    threshold
    Type
    float
    Description

    Die Guthabenschwelle, unterhalb welcher Guthaben übertragen werden soll.

  • Name
    amount
    Type
    float
    Description

    Der Guthabenbetrag, der bei unterschreiten von threshold vom Hauptaccount an den Subaccount gesendet werden soll.

Anfrage

POST
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "id=49176123456789" \
  -d "threshold=100.0" \
  -d "amount=200.0"

Antwort im Erfolgsfall

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

POST/api/subaccounts?action=transfer_credits

Manuelle Guthabenübertragung

Mit dieser API können Sie einmalig Guthaben vom Hauptaccount auf den Subaccount übertragen.

Parameter

  • Name
    id
    Type
    integer
    Description

    ID des Subaccounts.

  • Name
    amount
    Type
    float
    Description

    Zu übertragendes Guthaben.

Anfrage

POST
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
  -d "id=123456789" \
  -d "amount=250.0"

Antwort

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

POST/api/subaccounts?action=delete

Löschen von Subaccounts

Mit dieser API können Subaccounts gelöscht werden anhand ihrer ID.

Parameter

  • Name
    id
    Type
    integer
    Description

    ID vom Subaccount.

request

POST
/api/subaccounts?action=delete
curl -G https://gateway.seven.io/api/subaccounts?action=delete \
-H "X-Api-Key: YOUR_API_KEY" \
-d "id=123456789"

Antwort

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