Customers
The customer endpoint allows API clients to search, create, update and delete
customer records in the underlying OCNCC system.
GET /api/customer
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. |
Examples
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customer?name=rapi' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Response:
[
{
"name" : "Rapidity Inc",
"customer_sns" : "0800134123",
"id" : "3134"
},
{
"customer_sns" : "0800555132, 08005551232",
"id" : "1551",
"name" : "Rapidity Locators Inc"
}
]
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. |
Examples
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customer/3134' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
Response:
{
"name" : "Rapidity Inc",
"customer_reference" : "430184/A",
"id" : "3134"
}
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. |
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 |
|---|---|---|
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. |
Examples
File customer.json:
{
"customer_reference": "430184/B"
, "description": "This is a test update"
}
Request:
curl 'http://localhost/jarvis-agent/n2fe/api/customer/3134' -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:
{
"username" : "su",
"success" : 1,
"error_string" : "",
"group_list" : "ACS_BOSS,CCS Superuser",
"modified" : 1,
"logged_in" : "1"
}
If the customer ID provided 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:
{
"message" : "Customer reference is too long",
"success" : 0,
"group_list" : "ACS_BOSS,CCS Superuser",
"logged_in" : "1",
"error_string" : "",
"username" : "su"
}