Last Updated: 7/7/2021 1:24:23 AM
To create a customer company, you should call Customers :: Create along with the company profile and one default user account profile.
NotePut the company_id, the Customer Company ID of the newly created customer, you got
from the
response data in a variable because you will need it later when you subscribe to a
service
plan.
|
method = "POST"
request_uri = "/LMPI/v2/customers"
body = {
"company": {
"name": "CSPITest",
"address": "Main Street",
"city": "LA",
"state": "CA",
"postal_code": "101",
"country": "US",
"note": ""
},
"user": {
"login_name": "cspitest",
"first_name": "Test",
"last_name": "Test",
"phone": {
"area_code": "987",
"number": "654-321",
"extension": ""
},
"email": "test.test@cspi_test.com",
"time_zone": "Pacific Standard Time",
"language": "en-US"
}
}
body = json.dumps(body)
res_status, res_data = cspi_conn.send_request(method, request_uri, body)
print "Response status: %s", res_status
print "Response data: \n%s", res_data
company_id = None
if res_status == 200:
res_data = json.loads(res_data)
company_id = res_data["company_id"] # Put company_id in a variable
If successful, the output will be:
Response status: 200
Response data:
{
"company_id": "640FE47F-5118-4D79-8221-A35D0DE2EE2C",
"user": {
"id": "B7F4B24F-3842-4112-BADF-B7C19B00FBC7",
"login_name": "cspitest",
"password": "hkcuc3528HK"
}
}
To subscribe a service plan to the new customer company, you should use Customers
::
Subscription :: subscribe along with the Customer Company ID and Service Plan ID.
However, if you
do not know the Service Plan ID, you can call Me :: Service Plans :: list to list
all your
service plans and their IDs.
NoteKeep the subscription_id that you get from the response data because you will use
it when you want to use Customers :: Subscription :: Update to update the subscription, such as when you want to add seats, extend the license,
etc.
|
method = "POST"
request_uri = "/LMPI/v2/customers/%s/subscriptions" % company_id # Customer Company ID
body = {
"service_plan_id": "5862A768-CB5F-4B71-8F35-B619040BDAD2",
"units_per_license": 20
}
body = json.dumps(body)
res_status, res_data = cspi_conn.send_request(method, request_uri, body)
print "Response status: %s", res_status
print "Response data: \n%s", res_data
subscription_id = None
if res_status == 200:
res_data = json.loads(res_data)
subscription_id = res_data["subscription_id"] # Put subscription_id in a variable
If successful, the output will show as:
Response status: 200
Response data:
{
"subscription_id": "C6602FD7-2F15-4431-89CD-0355B80E1425",
"product_name": "Clone-LMP-WFBSS",
"service_url": "https://clp.trendmicro.com/?T=9ABIQ",
"licenses": [
{
"product_id": "WFSBWXE3X",
"version": "full",
"ac_code": "WF-WBKG-ZDLB8-TSVW5-DV6MQ-ZTGC5-VHLDP",
"units": 20,
"license_start_date": "2013-05-15T00:00:00Z",
"license_expiration_date": "2013-06-15T00:00:00Z",
"start_charge_date": "2013-05-15T00:00:00Z"
}
]
}
Suppose the service plan that you subscribed for the new customer is WFBSS, you should
initialize it right after the subscription by calling WFBSS :: initialize.
method = "POST" request_uri = "/SMPI/service/wfbss/api/initialize?cids=%s" % company_id # Customer Company ID res_status, res_data = cspi_conn.send_request(method, request_uri) print "Response status: %s", res_status print "Response data: \n%s", res_data
If successful, the output will show as:
Response status: 200 Response data:
