Find the answers you need

Support Database

How do I retrieve a list of StackUsers using the API?

GET  /reseller/{id}/susers

This endpoint can be used to get information about StackUsers within a 20i account. Specifically, the response will contain an array of objects detailing the contact(s) assigned to the StackUser(s), and a grant map of services the StackUser has been assigned to.

PHP examples use our API wrapper, which can be downloaded here: https://my.20i.com/reseller/api

PHP

Request:

require “vendor/autoload.php”; //We specify the API wrapper location.
$bearer_token = “INSERT YOUR GENERAL API KEY”; //Your 20i API key.
$services_api = new \TwentyI\API\Services($bearer_token);
$sUsers = $services_api->getWithFields(”/reseller/*/susers”;

return $sUsers;

Result:

{
    "contact": {
        "stack-user:808833": {
            "address": "Hawthorn House\nSouthwell Road West\n",
            "avatarUrl": "",
            "cc": "GBR",
            "ccAlpha2": "GB",
            "ccAlpha3": "GBR",
            "city": "Rainworth, Mansfield",
            "company_name": "",
            "company_number": "",
            "createdAt": "2019-08-20T19:55:56+00:00",
            "email": "supportteam@example.com",
            "ext_billing_ref": null,
            "nominet_contact_type": "IND",
            "notes": "",
            "pc": "NG21 0HJ",
            "person_name": "20i Ltd",
            "sp": "Nottinghamshire",
            "trading_name": "",
            "voice": "+44.800000000",
            "firstName": "20i",
            "lastName": "Ltd"
        }
    },
    "grant_map": {
        "stack-user:74562": {
            "package:2680": 1,
            "package:208423": 1,
            "package:6463": 1,
            "package:593453": 1,
            "package:593459": 1,
            "domain:6535": 1,
            "package:32025": 1,
            "vps:2301": 1,
            "package:93517": 1,
            "package:797247": 1
        },

If an object needs to be accessed specifically, we can specify this as follows:

$sUsers->contact

This would then have the effect of only showing the contact object.