JSON API » peers » peers/costs/list
Gets the fields of costs in a given peer.
Input parameters
Requires authentication and the system owner role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| peer | Integer | ID of peer to get costs for. | Yes | |
| called_prefix | String | Only return costs with called prefix starting with this string. Empty string for all. | No | Empty string. |
| count | Integer | 1 to return a count, 0 to return full data. | No | 0 |
| descending | Integer | 1 to sort descending, 0 not to. | No | 0 |
| limit | Integer | The maximum results to return. 0 for all. | No | 0 |
| media | String | Only return costs with this media. "fax", "voice", "voice_fax", or empty string for all. | No | Empty string. |
| offset | Integer | The result to start at. 0 for the first. | No | 0 |
| pages | Integer | 1 to return a reduced set of data for generating the pages select box, 0 to return full data. | No | 0 |
| prefix | String | Only return costs with prefix starting with this. Empty string for all. | No | Empty string. |
| sort | String | Field to sort by. "allow", "media", or "prefix". | No | "prefix" |
Responses
| Code | Description |
|---|---|
| 200 | Success. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 404 | The peer does not exist. |
Data returned
An array of fields, corresponding to the rows of the peer_costs table in the database.
Example: With required parameters
http://enswitch.example.com/api/json/peers/costs/list/?auth_username=user;auth_password=password;peer=123{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "id":1, "peer":123, "called_prefix":"", ... }, { "id":2, "peer":123, "called_prefix":"011", ... } ] }
Change history
| Version | Changes |
|---|---|
| 3.15 | Function added. |
