API : Change Log List
Introduction
This request will return the list of changes performed on a customer, a section or a specific item.
Request
| URL | https://api.telecomx.dk/log/changelog/customer/CUSTOMER_ID |
| https://api.telecomx.dk/log/changelog/customer/CUSTOMER_ID/SECTION |
| https://api.telecomx.dk/log/changelog/customer/CUSTOMER_ID/SECTION/ITEM_ID |
| Method | GET |
| Access level | VIEWER, MANAGER or OWNER if looking up for own customer
RESELLER if customer belongs to the reseller or a subreseller
RESELLER_ADMIN for any customer and system wide sections |
| Query | offset | [optional] Index of the first log event to return, default 0. |
| limit | [optional] The number of log events to return, default 100, min 1, max 500. |
| includeData | [optional] If true, the full item as it looked like when it was created or before it was updated or deleted, is included. |
| includeEmployees | [optional] If true an additional array is returned with all the employees who has caused the events listed, so that it is easy to put a name/e-mail on who caused the event to happen. |
| version | [optional] Which version of the endpoint to use. Defaults to 1 |
| includeChanges | [optional] [version 2] Whether to include the changes between change logs or not. |
| sortBy | [optional] [version 2] Sort by property. Currently only allows 'when' |
| orderBy | [optional] [version 2] Order by property. Allowed values are “ASC” and “DESC”. Defaults to “ASC”. |
| what | [optional] [version 2] Filters logs based on what sort of action it is (the 'what'-property on each log). Allowed values are CREATE, UPDATE, DELETE, OTHER. |
| Params | CUSTOMER_ID | Id of the customer the events happened on. If it happened in a non-customer section, then this must be set to 'SYSTEM'. |
| SECTION | [optional] Name of the section the events happened in. Valid sections are listed below. If not included, then all events on the customer is included in the response. |
| ITEM_ID | [optional] Id of an item, e.g. to list only events on a given sip account, this would be the id of the sip account. |
| Valid section named |
| CurrentInvoices | Customers | DeletedMvnoAccounts |
| Employees | MvnoAccounts | Dsls |
| Fibers | Numbers | Portings |
| Products | MvnoSims | |
| SipAccounts | PbxDialplans | SipPhones |
| PbxMusicOnHold | PbxAudios | PbxSettings |
| HumanTasks | IpTvDevices | |
Query examples
https://api.telecomx.dk/log/changelog/customer/1234567890ABCDEF12345678
https://api.telecomx.dk/log/changelog/customer/1234567890ABCDEF12345678/employees
https://api.telecomx.dk/log/changelog/customer/1234567890ABCDEF12345678/employees/1234567890ABCDEF12345678
https://api.telecomx.dk/log/changelog/customer/1234567890ABCDEF12345678/employees?offset=10&limit=20&includeData=true&includeEmployees=true
https://api.telecomx.dk/log/changelog/SYSTEM/employees?offset=10&limit=20&includeData=true&includeEmployees=true
https://api.telecomx.dk/log/changelog/SYSTEM/employees/1324657980ABCD1234657980ABCD1234567890?offset=10&limit=20&includeData=true&includeEmployees=true
Response
Version 1
| JSON object |
| offset | Index of the first event returned. |
| limit | Number of events to return. Note that the actual number of events returned may be lower. |
| total | Number of events that can be returned when offset and limit is not considered. This is to be used for paging through the data. |
| log | Array of changelog events, see definition below |
| employees | Array of employees who caused the listed events, each with _id, name and emailAddress |
| Log object (JSON) |
| _id | Id | Unique event id. |
| employee | Id | Id of the employee who caused the event, null if caused by the system. |
| when | Date | Date and time the event took place. |
| where | String | Name of the section where the event happened. See list above of valid section names |
| what | String | Type of event: CREATE, UPDATE, DELETE or OTHER. |
| description | String | Optional description of what happened, human-readable english language. |
| data | Object | If includeData query argument is set, then the data object is included. This is the item as it looked like at creation (if what=CREATE) or how the item looked like before it was updated or deleted (what=UPDATE or DELETE). |
Version 2
| JSON object |
| offset | Index of the first event returned. |
| limit | Number of events to return. Note that the actual number of events returned may be lower. |
| total | Number of events that can be returned when offset and limit is not considered. This is to be used for paging through the data. |
| log | Array of changelog events, see definition below |
| Log object (JSON) - if version=2 |
| _id | Id | Unique event id. |
| employee | Id | Id of the employee who caused the event, null if caused by the system. Only included if the the consumer has access to see who caused the change. |
| employeeName | String | Name of the employee who caused the event. If the system made the event, this value will be 'System'. |
| when | Date | Date and time the event took place. |
| where | String | Name of the section where the event happened. See list above of valid section names |
| what | String | Type of event: CREATE, UPDATE, DELETE or OTHER. |
| description | String | Optional description of what happened, human-readable english language. |
| changes | Change[] | The changes made when this log was written, compared to how it was previously |
| changes[].key | String | Name of key, e.g ratePlan, name, notes. |
| changes[].oldValue | any | Old value, before update |
| changes[].oldDisplayValue | any | Old display value, e.g the name of the rate plan being changed, and not just an ID. |
| changes[].newValue | any | New value, after update |
| changes[].newDisplayValue | any | Old display value, e.g the name of the rate plan being changed, and not just an ID. |
| data | Object | If includeData query argument is set, then the data object is included. This is the item as it looked like at creation (if what=CREATE) or how the item looked like before it was updated or deleted (what=UPDATE or DELETE). |
| impersonatedBy | ObjectId | Id of impersonator, if user was impersonated. |
| impersonatedBySystem | Boolean | If the user was impersonated by the system, e.g a scheduled job is performed on the user's behalf. |
Note that properties holding no value may be omitted from the object.
Example - normal (v1)
{
offset: 10,
limit: 25,
total: 243,
log:
[
{
_id: '1234567890ABCDEF12345678',
employee: '1234574890ABCDEF12345678',
when: IsoDate('2014-01-01T12:34:56.123Z'),
where: 'Employees',
what: 'UPDATE',
description: 'Password has been reset',
data: { ... not included here ... }
},
{
...
}
]
}
Example - normal (version 2)
{
offset: 10,
limit: 25,
total: 243,
log:
[
{
_id: '1234567890ABCDEF12345678',
employee: '1234574890ABCDEF12345678',
employeeName: 'Jens Mogensen',
when: '2014-01-01T12:34:56.123Z',
where: 'Employees',
what: 'UPDATE',
description: 'Password has been reset',
changes: [],
data: { ... not included here ... }
},
{
_id: '5234567890ABCDEF12345678',
employee: null,
employeeName: 'Administrator',
when: '2014-01-01T13:15:42.401Z',
where: 'Employees',
what: 'UPDATE',
changes: [
{
key: 'ratePlan',
oldValue: '1234567890ABCD1324657890',
oldDisplayValue: 'Basic Tale',
newValue: '1234657980ABCD1324567980',
newDisplayValue: 'Fri tale, 5 gb data'
}
],
data: { ... not included here ... }
},
{
_id: '5234567890ABCDEF12345678',
employee: null,
employeeName: 'System',
when: '2014-01-01T14:50:00.565Z',
where: 'Employees',
what: 'UPDATE',
changes: [
key: 'newRatePlan',
oldValue: null,
oldDisplayValue: 'N/A',
newValue: '1234567980ABCD1324567980',
newDisplayValue: 'Mobil datakort 100gb,
],
description: null,
data: { ... not included here ... }
},
{
...
}
]
}
Errors
| Error code | Message | Description |
| 403 | access_denied | Insufficient access level |