This document describes the base API interfaces which can be used with Panacea Mobile.
The API is currently only implemented with a JSON wrapper.
These API's can be accessed with an HTTP client independent of language. We have provided PHP examples to demonstrate the implementation as well as raw HTTP requests in order to assist.
Some general considerations:
= Negative number in status codes indicate an error
= HTTP Keep-Alive is supported and should be used for large numbers of queries.
= Unbilled queries are limited to 10 per minute (message_status, user_get_balance, etc)
Gets a list of contacts for a particular group
Add a contact to a group
Delete a contact
Update an existing contact
Retrieves a list of address book groups
Example output : {"status":0,"message":"OK","details":[{"id":"1","name":"My Friends"}]}
Adds a new address book group
Deletes an address book group
Returns the default pricing for new registrations
Returns the list of countries used by this system
This action allows affiliate users to create new users, please contact support@panaceamobile.com if you are interested in becoming an affiliate.
Please note that this method returns its own status codes, an English error message will be returned to you, it is at your own discretion to translate these strings.
Example output: {"status":0,"message":"OK","details":{"user_id":"67","username":"testdd","password":"10jm06","message":"User created successfully."}}
This action allows affiliate users to create new users, please contact support@panaceamobile.com if you are interested in becoming an affiliate.
An English error message will be returned to you, it is at your own discretion to translate these strings.
When a user is created the new username will be returned and an auto generated password will be sent to them via SMS.
Example output: {"status":0,"message":"OK","details": "george"}
Public method that sets promotion codes for new users
Retrieves a list of the user batches.
Example output: {"status":0,"message":"OK","details":[{"id":"11","name":"test","status":32,"deletable":false},{"id":"12","name":"Relationships","status":32,"deletable":false}]}
Checks the status of a batch
Creates a new batch, returns batch ID if successful
This action supports zip compression of files, these must be base64 encoded zip files.
Starts the given batch
Stops/pauses the given batch
This action allows you to execute multiple actions within the API with a single request.
The payload (with all actions) must be sent in a POST request with a variable named 'data' containing a JSON encoded array of actions to execute.
An array of results sent in the same order they were received will be returned.
Public method that returns affiliate country information. Primarily used for detecting number prefixes.
This performs an HLR request and gives you the result via an HTTP callback
This is the recommended method for large volumes of HLR requests
Ouput contains keys: details (request ID)
This performs an HLR request and gives you the result immediately.
This method is only recommended for small volumes and you will be limited to a maximum of 5 simultaneous requests using this method.
Example output contains keys: number_status, mcc, mnc, country_code, network_name
This is for using our free leads service to inject leads.
Although this system filters out duplicate leads, best practise would be to manually filter the leads yourself as we only filter on a per batch basis.
Example output: {"status":0,"message":"OK","details":"Lead Created"}
This method provides all a list of all methods currently available in the API and their parameters
This function returns all inbound (MO) messages for the user which have an ID larger than 'last_id'.
Best practice is to use this function starting with last_id = 0, then as messages are received, to store last_id as the highest message ID you receive back from the API request. Results are limited to 50 at a time.
Example ID {"status":0,"message":"OK","details":[{"id":"11","created":"2011-04-09 19:25:09","from":"27832659217","to":"20000","data":"Test MO Generated","charset":"UTF-8"},{"id":"10","created":"2011-04-09 19:24:02","from":"27832659217","to":"20000","data":"Test MO Generated","charset":"UTF-8"}]}
Statistics for the user account. These are a summarized value and should only be user to provide a broad overview of statistics.
Example output: {"status":0,"message":"OK","details":{"sent":231709,"dlr_received":162,"received":5,"dlr_requested":200}}
Send an SMS message
In the return result, if successful the details key will contain the message ID.
Example output : {"status":1,"message":"Sent","details":"8beda1a8-5c12-489f-0107-123000000003"}
Checks the status of a message
This function can only be used 10 times per minute (to prevent bad implementation :)) if you require status for each message you send please use the report_url and report_mask variables when sending your messages with message_send().
Example ouput: {"status":0,"message":"OK","details":{"status":1,"cost":0.20000,"parts":1}}
Function to ensure communication
This action allows you to check the price you can expect to pay for a message to the destination in 'to'
Output will contain the cost in the the details key.
This action allows a third party application to get an authentication key in order to make use of a user's account.
The benefits of using this method is know that the application doesn't have to worry about registration of the user account, it simply redirects the user to a web based location (which is provided) for authentication, once done, if the user allowed it, the application can access the API functions using the new API token.
WARNING: Request key's generated here can only be guaranteed to be valid for 1 hour, so you *MUST* call user_get_api_key() after the process has been completed.
The output details key contains 'authorize_url' where the user should be sent to and 'request_key' which is the key to be used for API key creation once complete.
Once the user_authorize_application() action is completed and the user has returned to your application, you must call user_get_api_key() to create a permanent API key.
Details key contains 'username' and 'key' which can be used as username and password combinations in subsequent requests.
Gets the user balance
Gets the user details
This function returns the verified phone number for the given user
Example output {"status":0,"message":"OK","details":"0832659217"}
Transfer credit from one account to another
Example output {"status":0,"message":"OK","details":3338.50000}
Authentication failure
Could not save
Duplicate record found (when adding)
Internal error
Invalid record
API Request Key created
Message sent/queued
There was a required parameter missing from the request (see 'details' key in result for more information)
No action was specified in the request
There was no matching action found
Generic OK
Out of credit
Routing error
User has exceeded the maximum number of simultaneous requests to the API
User has exceeded the maximum number of simultaneous requests to the API
User is not part of any affiliate program
User does not have HLR enabled on his account
Batch is busy being processed
There was an error processing the batch
The batch is waiting to be filtered.
Set the batch to this status if you wish for it to be filtered.
Batch is busy being filtered
Batch is waiting to be processed
Batch is busy being parsed
Parsing of the batch has been paused
Batch has been parsed and is currently paused
Batch is waiting to be processed (no action required)
Batch has been submitted
User has reached maximum registrations during specified period.
Message acknowledged
Message has been delivered
Message does not exist
Message failed
Filtered (blocked or previously failed)
Message failed (internal error)
Routing error
Message has been sent to the networks