Find the answers you need
Support Database
How do I retrieve a list of StackCP Users using the API?
This endpoint can be used to get information about StackCP Users within a 20i account. Specifically, the response will contain an array of objects detailing the contact(s) assigned to the StackCP User(s), and a grant map of services the StackCP User has been assigned to.
PHP examples use our API wrapper, which can be downloaded here: https://my.20i.com/reseller/api
PHP
Request:
<span class="hljs-meta">require “vendor/autoload.php”; //We specify the API wrapper location.</span>
<span class="hljs-meta">$bearer_token = “INSERT YOUR GENERAL API KEY”; //Your 20i API key.<br />
$services_api = new \TwentyI\API\Services($bearer_token);<br />
$sUsers = $services_api->getWithFields(”/reseller/*/susers”; </span>
<span class="hljs-meta">return $sUsers;</span>
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.