Views:

Last Updated: 7/4/2021 11:51:16 AM

You can list all your WFBSS customers by using GET /SMPI/service/wfbss/api/customers.

Important: If you created a new customer without using SMPI or you do not update the customer's license before using GET /SMPI/service/wfbss/api/customers, wait for 10-15 minutes to ensure the modifications has been updated. Otherwise; the result you get might not be real-time.

limit = 100
page = 1
method = "GET"
request_uri = "/SMPI/service/wfbss/api/customers?limit=%s&page=%s"\
    % (limit, page)

# Get the 1st page of customers and the paging information
res_status, res_data = cspi_conn.send_request(method, request_uri)
print "Response data (page %s): \n%s" % (page, res_data)

# Calculate how many pages there will be
res_data = json.loads(res_data)
total = res_data["paging"]["total"]
import math
total_page = math.ceil(total/float(limit))

# Get the remaining pages
page = page + 1
while page <= total_page:
    request_uri = "/SMPI/service/wfbss/api/customers?limit=%s&page=%s"\
        % (limit, page)

    res_status, res_data = send_request(method, smpi_base_url, request_uri, cspi=False)
    print "Response data (page %s): \n%s" % (page, res_data)

    page = page + 1

If successful, one of the pages will show as:

Response data (page 2):
{
  "paging": {
    "total": 260,
    "limit": 100,
    "page": 2
  },
  "customers": [
    {
      "license_period": 1,
      "auto_renewal": 0,
      "name": "Test",
      "time_zone": "Asia/Taipei",
      "seat_count": 30,
      "expire": "2013-06-15T00:00:00Z",
      "sp_subscription": "Worry Free Business full version (monthly)",
      "license_type": "1",
      "id": "c6602fd7-2f15-4431-89cd-0355b80e1425"
    },
    {
      "license_period": 1,
      "auto_renewal": 0,
      "name": "ABC Test Company",
      "time_zone": "Asia/Taipei",
      "seat_count": 20,
      "expire": "2013-06-20T00:00:00Z",
      "sp_subscription": "Worry Free Business full version (monthly)",
      "license_type": "1",
      "id": "549390c2-61b3-417e-b1f0-8955a63c08f3"
    },
     ...
  ]
}