Sarv.com

PYTHON

Choose Language

Upload Announcement API

http://<domain_name>/api/voice/upload_announcement.php?username=<username>&token=<token>&announcement_path=<announcement_path>

Upload Announcement API through Sarv

Example


try:
    import requests
    result = requests.post("http://<domain_name>/api/voice/upload_announcement.php", data={'username':'username','token':'abcXYZ','announcement_path':'announcement_path'})    
    print result
    '''
    {
        "status":"success",
	"code":"000",
	"desc":"Announcement Uploaded Successfully",
	"data":
			  {
				 "announcement_id":"1234",
				 "announcement_name":"filename.mp3"
			  }
    }d
    '''
except e:
    print 'A error occurred: %s - %s' % (e.__class__, e)

Example Success Response


{
	"status":"success",
	"code":"000",
	"desc":"Announcement Uploaded Successfully",
	"data":
			  {
				 "announcement_id":"1234",
				 "announcement_name":"filename.mp3"
			  }
}

Example Error Response


{
	"status":"error",
	"code":"007",
	"desc":"Invalid announcement type (mp3 allowed only)"
}

Parameters
username* string a valid Sarv SMS Panel User Name
token* string a valid token
announcement_path* string a valid Announcement Path
* compulsory field
Return Value: Success
struct the results of Upload Announcement API
status string success
code string 000
desc array { "announcement_id":"1234", "announcement_name":"filename.mp3" }
Return Value: Error
struct the error results when Upload Announcement API
status string error
code string 007
desc string Invalid announcement type (mp3 allowed only)
Api Response Codes
000 Announcement Uploaded Successfully.
001 Parameter Missing .
002 Parameter is blank.
003 Request IP not added in whitelist .
004 Invalid user type.
005 Invalid Credentials.
006 User is InActive.
007 Invalid announcement type .