This section will help you know the amount of credit usage for a specified period of time for each of your API keys generated

Definition

https://apps.mnotify.net/smsapi/api_usage

Parameters

Argument Type Required Description
key string Yes Your generated api key of alphanumeric format
from string Yes The start date and time in the format YYYY-MM-DD H:si:s Example 2018-07-25 00:00:00
to string Yes The end date and time in the format YYYY-MM-DD H:si:s Example 2018-07-25 23:59:59

Examples

The following is going to show you some examples that you can follow to set up your integration. The languages used here are PHP, Java and Python

PHP

//defining the parameters
$key = "YOUR_API_KEY";  // Remember to put your own API Key here
$from = "2018-07-25 00:00:00";
$to = "2018-07-25 23:59:59";

//encode the message
$msg = urlencode($msg);

//prepare your url
$url = "https://apps.mnotify.net/smsapi/api_usage?"
            . "key=$key"
            . "&from=$from"
            . "&to=$to";
$response = file_get_contents($url) ;
//response contains the response from mNotify

NB: Remember that this is a GET request

Java

import java.net.*;

import java.io.*;

public class SendMessage {

    public static void main(String[] args) throws Exception {
        String API_key = "YOUR_API_KEY";  // Remember to put your own API Key here
        String from = "2018-07-25 00:00:00";
        String to = "2018-07-25 23:59:59";
        
        //prepare your url
        URL url = new URL("' . base_url() . 'smsapi/api_usage?key=" + API_key + "&from=" + from + "&to=" + to);
           
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String inputLine;
        inputLine = in.readLine().trim();
       //input line contains the response from mNotify
        in.close();
    }
}

NB: Remember that this is a GET request

Python

#!/usr/bin/env python
import urllib2
import urllib

def send_sms(api_key,from,to):
    #parameters to send SMS
    params = {\"key\":api_key,\"from\":from,\"to\":to}

    #prepare your url
    url = '" . base_url() . "smsapi/api_usage?'+ urllib.urlencode(params)
    
    content = urllib2.urlopen(url).read()
    #content contains the response from mNotify
    
    
#Defining variables to be used inside function
api_key = 'YOUR_API_KEY' #Remember to put your own API Key here
from = '2018-07-25 00:00:00'
to = '2018-07-25 23:59:59'

#Calling function that was created to send sms
send_sms(api_key,from,to)";

NB: Remember that this is a GET request

Result Format

Result that would be obtained upon successful delivery of message.

JSON

 	[
 	  {
 	    "status": "1000",
 	    "data": {"contacts": 245, "charge": 350},
 	  },
 	]
 	
Parameter Type Description
status int A four digit code which specifies a particular response message
data object The object response which contains number of contacts which has used the credits and the actual credit value

Status Codes and Interpretation

Status Code Meaning
1000 Successful
1004 Invalid API Key
1009 Empty from date and to date
1010 No messages has been sent on the specified dates using the specified api key