JSON API » cards » cards/files/download
Downloads a message file for a card group.
Input parameters
Requires authentication and the cards role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
cardgroup | Integer | ID of card group. | Yes | |
file | String | Which message file to download. "balance", "connecting", "destination", "dest-invalid", "expired", "goodbye", "in-use", "locked", "no-credit", or "no-permission-to-dial-number". | Yes | |
check | Integer | 1 to just check if the file exists, 0 to download it. | No | 0 |
encoding | String | "base64" to return file base64 encoded, "raw" to return raw data. | No | "raw" |
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 card group or file does not exist, or you do not have permission to view it. |
500 | The sound file cannot be read. |
If check=1 was specified and the file does not exist, 200 is returned.
Data returned
If checking, whether the file was found or not. If not checking, the sound file data plus name and mime-type.
Example: Download file (data truncated for brevity)
http://enswitch.example.com/api/json/cards/files/download/?auth_username=user;auth_password=password;cardgroup=123;file=destination{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123, "name":"example.wav", "mimetype":"audio/x-wav", "data":"RIFFn..." } }
Example: Check if file exists, and it does
http://enswitch.example.com/api/json/cards/files/download/?auth_username=user;auth_password=password;cardgroup=123;file=destination;check=1{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "found":1 } }
Example: Check if file exists, and it doesn't
http://enswitch.example.com/api/json/cards/files/download/?auth_username=user;auth_password=password;cardgroup=123;file=destination;check=1{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "found":0 } }
Change history
Version | Changes |
---|---|
3.13 | Function added. |