Customers
Customers
The customer
endpoint allows API clients to search, create, update and delete
customer records in the underlying OCNCC system.
GET /api/customers
Search customers. Only customers accessible to the currently authenticated user will be returned in search results.
This request supports the following parameters:
Parameter | Example | Description |
---|---|---|
name
|
Plumb
|
The search term. This term will be used in a case insensitive substring match against both customer names and service numbers stored in the underlying OCNCC system. This allows the search term to encompass both freephone & service numbers as well as customer names. Note that a search term is optional. |
Response Content
The response will be a JSON array of objects, with each object consisting of the following information:
Key | Type | Description |
---|---|---|
customer_sns |
String | A comma separated list of service numbers associated with the customer. E.g. 0800123123, 0800123444, 19001232454 . |
id |
Integer | The unique ID of the customer. To be used whenever a customer ID is required. |
name |
String | The unique name of the customer. |
reference |
Integer | An external system customer reference for the customer. Used to match the customer ID in the underlying OCNCC system with external systems. |
Examples
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customers?name=rapid' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Response:
[
{
"reference" : "21345345",
"customer_sns" : "",
"name" : "RAPID Centres",
"id" : "213654"
},
{
"id" : "23527",
"name" : "RAPIDS JET",
"customer_sns" : "0508727437",
"reference" : "6677620"
},
{
"id" : "23165",
"name" : "Rapid Raiders",
"reference" : "02316545498",
"customer_sns" : "0800333541"
},
{
"name" : "Rapid Stoppers",
"id" : "45661",
"customer_sns" : "08002137545, 08008945645",
"reference" : "21547843"
}
]
GET /api/customer/:customer_id
Retrieve details for a specific customer. Only customers accessible to the currently authenticated user will be returned in the returned results.
This request supports the following parameters:
Parameter | Example | Description |
---|---|---|
customer_id
|
3213
|
[URL parameter], [Required] The ID of the customer to retrieve. |
Response Content
The response will be a single JSON object consisting of the following information:
Key | Type | Description |
---|---|---|
customer_reference |
String | An external system customer reference for the customer. Used to match the customer ID in the underlying OCNCC system with external systems. |
description |
String | A general description field for the customer record. |
id |
Integer | The unique ID of the customer. To be used whenever a customer ID is required. |
name |
String | The unique name of the customer. |
pt_tn_range_policy |
Integer | Defines what numbers can be used in an attempt terminate (connect) node. |
max_users |
Integer | The maximum number of users this customer is allowed. |
pt_customer_language |
Integer | The default language for announcements. |
max_call_plans |
Integer | The maximum number of call plans this customer is allowed. |
managed |
Integer | Whether a customer is self managed, or managed by a telco. |
Examples
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customer/45856' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Response:
{
"pt_tn_range_policy" : 0,
"max_users" : "20",
"pt_customer_language" : 1,
"customer_reference" : "15808125",
"name" : "Plumbers and Gasfitters",
"max_call_plans" : "20",
"id" : "45856",
"managed" : "1"
}
PUT /api/customer/:customer_id
Update the details for a specific customer. Only customers accessible to the currently authenticated user may be updated. Any other user update will cause an error.
This request supports the following parameters:
Parameter | Example | Description |
---|---|---|
customer_id
|
3213
|
[URL parameter], [Required] The ID of the customer to update. |
The content of the PUT request must be a JSON object with the following fields:
Key | Type | Description |
---|---|---|
customer_reference |
String | An external system customer reference for the customer. Used to match the customer ID in the underlying OCNCC system with external systems. |
description |
String | A general description field for the customer record. |
id |
Integer | The id of the customer. |
managed |
Integer | Whether the customer is self managed. |
max_call_plans |
Integer | The maximum number of call plans for this customer. |
max_users |
Integer | The maximum number of users for this customer. |
name |
String | The customer name. |
pt_customer_language |
Integer | The default language for announcements. |
pt_tn_range_policy |
Integer | Defines what numbers can be used in an attempt terminate (connect) node. |
Note that all fields must be provided. Missing fields will be set to NULL in the database.
Response Content
The response will be a single JSON object consisting of the following information:
Key | Type | Description |
---|---|---|
group_list |
String | A comma separated list of groups the current customer is a member of. |
success |
Integer | The success status of the put request. |
modified |
Integer | Whether modifications were made. |
error_string |
String | The error that occured. |
logged_in |
Integer | Weather the customer is logged in. |
username |
String | the customer username. |
Examples
File customer.json
:
{
"customer_reference": "430184/B"
, "description": "This is a test update"
}
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customer/50203' -T /tmp/customer.json -H 'Content-Type: application/json;charset=utf-8' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Success Response
On success the system will return the following information structure in JSON:
{
"modified" : 1,
"error_string" : "",
"success" : 1,
"group_list" : "ACS_BOSS,BCD_BOSS,CCS Superuser",
"username" : "su",
"logged_in" : "1"
}
If the customer ID provided in the URL does not match any customer, the modified
count
will be 0.
Error Response
On an error the system will return the following information structure in JSON:
{
"error_string" : "",
"group_list" : "ACS_BOSS,BCD_BOSS,CCS Superuser",
"logged_in" : "1",
"message" : "ORA-12899: value too large for column",
"success" : 0,
"username" : "su"
}
GET /api/customer/:customerId/compile/:session_id
Response Content
Key | Type | Description |
---|---|---|
id |
Integer | Boolean value indicating whether repatcha is enabled. |
profile_block |
Integer | The configured client habitat information. |
profile_tag_name |
String | The configured client habitat information. |
profile_tag |
Integer | The configured client habitat information. |
Examples
curl 'http://logan/jarvis-agent/n2fe/api/customer/50203/compile/5610264' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Not finished compiling:
[]
Finished compiling the plan:
[
{
"id" : "865108",
"error_string" : "[Note 113] [Control Plan Structure caller type testing flow]: Beginning Compile",
"compile_date" : "20180503044330"
},
{
"error_string" : "[Note 114] [Control Plan Structure caller type testing flow]: Compile Successful (10 nodes)",
"id" : "865109",
"compile_date" : "20180503044330"
},
{
"id" : "865110",
"error_string" : "[Note 109] [Control Plan Data caller type testing flow]: Beginning Compile",
"compile_date" : "20180503044331"
},
{
"id" : "865111",
"error_string" : "[Note 110] [Control Plan Data caller type testing flow]: Compile Successful",
"compile_date" : "20180503044331"
},
{
"compile_date" : "20180503044331",
"id" : "865112",
"error_string" : "[Note 112]: Finished"
}
]