API Request Call Options


M'accounts API Call Options

M'accounts API supports multiple calls in a single API request. Bellow are the details of the options;

Name Type Default Description
Identifier string / number null Unique value used to identify the the corresponding call details and status.
Module string null

Required Which module should process the call;

  • Customer
  • Supplier
  • Product
  • Service
  • Invoice
  • ReceiptOnInvoice
  • ReceiptOnSales
  • Bill
  • PaymentOnBill
  • PaymenVoucher
Action string null

Required How the call should be processed:

  • Insert
  • Update
  • Delete
  • Read
Parameters Array null

Module options corresponding to the action.

API Module Parameters


Customer

Name Type Default Description
Id number 0 M'accounts unique customer ID
Pin string null Unique external identifier
Name string null Required Full name
Email string null Email address
Phone string null Phone number
Address string null Physical address
Location string null Physical location
CreditLimit number 0 The customer's credit limit
Latitude number null Geographical Latitude
Longitude number null Geographical Longitude
PriceCategory string null Price category name
OpeningBalanceType string null 'Debit' Or 'Credit'
OpeningBalanceAmount number 0 Customer opening balance amount
Customer: Insert | Copy
Customer: Update | Copy
Customer: Delete | Copy
Customer: Read (Only specific records) | Copy
Customer: Read (All records) | Copy

Supplier

Name Type Default Description
Id number 0 M'accounts unique supplier ID
Pin string null Unique external identifier
Name string null Required Full name
Email string null Email address
Phone string null Phone number
Address string null Physical address
Location string null Physical location
Latitude number null Geographical Latitude
Longitude number null Geographical Longitude
OpeningBalanceType string null 'Debit' Or 'Credit'
OpeningBalanceAmount number 0 Customer opening balance amount
Supplier: Insert | Copy
Supplier: Update | Copy
Supplier: Delete | Copy
Supplier: Read (Only specific records) | Copy
Supplier: Read (All records) | Copy

Counterparty

Name Type Default Description
Id number 0 M'accounts unique counterparty ID
Pin string null Unique external identifier
Name string null Required Full name
Email string null Email address
Phone string null Phone number
Address string null Physical address
Location string null Physical location
CreditLimit number 0 The counterparty's credit limit
Latitude number null Geographical Latitude
Longitude number null Geographical Longitude
PriceCategory string null Price category name
OpeningBalanceType string null 'Debit' Or 'Credit'
OpeningBalanceAmount number 0 Counterparty opening balance amount
Counterparty: Insert | Copy
Counterparty: Update | Copy
Counterparty: Delete | Copy
Counterparty: Read (Only specific records) | Copy
Counterparty: Read (All records) | Copy

Product

Name Type Default Description
Id number 0 M'accounts unique product ID
InventoryTracking string No Enable / Disable inventory tracking
Name string null Required Full name
Price number 0 Rate at which the product is sold
Cost number 0 Cost at which the product is purchased
Units number 1 Number of units per item
Barcode string null Product Barcode
Pin string null Unique external identifier
Category string null Product category name
OpeningQuantity number 0 Product opening quantity
OpeningQuantityDate Date Today Date when to pass the opening balance entry
Currency string Product Price and Cost value currency
Manufacture string null Product manufacture
Description string null Product Description
Batch string null Product Batch
Expiry Date null Product Expiry
Product: Insert | Copy
Product: Update | Copy
Product: Delete | Copy
Product: Read (Only specific records) | Copy
Product: Read (All records) | Copy

Service

Name Type Default Description
Id number 0 M'accounts unique Service ID
Name string null Required Full name
Price number 0 Rate at which the service is offered
Barcode string null Service Barcode
Pin string null Unique external identifier
Category string null Service category name
Description string null Service Description
Service: Insert | Copy
Service: Update | Copy
Service: Delete | Copy
Service: Read (Only specific records) | Copy
Service: Read (All records) | Copy

Employee

Name Type Default Description
Id number 0 M'accounts unique Employee ID
Name string null Required Full name
Phone string null Employee phone number
Email email null Employee email
Pin string null Unique external identifier
Address string null Employee category name
TIN string null Tax Identification Number
Currency string null E.g. UGX, USD
BasicSalary number 0 Basic salary
Paygrade string null Pay-grade
Status string null Active,Suspended
Automate string null Automation config
TaxesAndDeductions array null Maccounts taxes and decuction codes
EarningAndCut array null Array of employee earning and cuts
Employee: Insert | Copy
Employee: Update | Copy
Employee: Delete | Copy
Employee: Read (Only specific records) | Copy
Employee: Read (All records) | Copy

Invoice

Name Type Default Description
Id number null M'accounts unique Invoice ID
DateTime DateTime now Invoice date and time (E.g. 2024-04-29 or 2024-04-29 20:47:01)
CounterpartyId number 0 M'accounts unique Customer ID
Number string auto Optional transaction number
Reference string null Optional Reference
Currency string auto Optional
DueDate date null Optional Invoice due date
Details array null Required Array of invoice details
Discount number 0 Optional Invoice Discounted amount
TaxableAmount number 0 Optional Invoice taxable amount
Memo number 0 Optional Invoice Memo
ExternalRef string null Optional Invoice external reference
Taxes array null Optional Invoice Tax details
MultiCurrency boolean false Optional Invoice multi-currency
CurrencyInEffect string null Optional Invoice effective currency
ExchangeRate number 0 Optional Invoice multi-currency exchange rate
Invoice: Insert | Copy
Invoice: Update | Copy
Invoice: Delete | Copy
Invoice: Read (Only specific records) | Copy
Invoice: Read (All records) | Copy

Receipt On Invoice

Same as configuration as "Invoice" module, but set Module value to "ReceiptOnInvoice" instead of "Invoice"

Receipt On Sales

Same as configuration as "Invoice" module, but set Module value to "ReceiptOnSales" instead of "Invoice"

Bill

Same as configuration as "Invoice" module, but set Module value to "Bill" instead of "Invoice"

Payment On Bill

Same as configuration as "Invoice" module, but set Module value to "PaymentOnBill" instead of "Invoice"

Payment Voucher

Same as configuration as "Invoice" module, but set Module value to "PaymentVoucher" instead of "Invoice"

PHP Sample code

<?php
    
    $Request = array(
        "AppName" => "app_name",
        "AppSecret" => "app_secret",

        "API_Username" => "xxxxxxxxxxxx",
        "API_Password" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

        "Call" => array(
            array(
                "Identifier" => "101",
                "Module" => "Customer",
                "Action" => "Insert",
                "Parameters" => array(
                    "Name" => "Rwamabondo Innocent",
                    "Email" => "r.inno@maccounts.biz",
                ),
            ),
            array(
                "Identifier" => "102",
                "Module" => "Customer",
                "Action" => "Insert",
                "Parameters" => array(
                    "Name" => "Kyakabale Bruce",
                    "Email" => "bruce@maccounts.biz",
                    "Phone" => "",
                ),
            ),
        )
    );

    $RequestJson = json_encode($Request);

    $Url = 'http://maccounts.ruginem.org/api/1.0/';

    $PostString = 'Request='.urlencode($RequestJson);

    //open connection
    $ch = curl_init();

    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $Url);
    curl_setopt($ch,CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $PostString);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    $Response = curl_exec($ch);

    //close connection
    curl_close($ch);
    
    /*
        $Response is a json string
        
        You can first convert $Response to a php array.
        And do as you will with the response as shown bellow
    */
    
    $ResponseArray = json_decode($Response, true);

    //Now you can process $ResponseArray


jQuery Sample code

<script>
    $(document).ready(function() {

        PostValues = {
            "AppName": "app_name",
            "AppSecret": "app_secret",
            "API_Username": "xxxxxxxxxxxx",
            "API_Password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "Call": [{
                    "Identifier": "101",
                    "Module": "Customer",
                    "Action": "Insert",
                    "Parameters": {
                        "Name": "Rwamabondo Innocent",
                        "Email": "r.inno@maccounts.biz"
                    }
                },
                {
                    "Identifier": "102",
                    "Module": "Customer",
                    "Action": "Insert",
                    "Parameters": {
                        "Name": "Kyakabale Bruce",
                        "Email": "bruce@maccounts.biz",
                        "Phone": ""
                    }
                }
            ]
        };

        $.ajax({
            url: 'http://maccounts.ruginem.org/api/1.0/',
            type: 'POST',
            data: {Request : JSON.stringify(PostValues) },
            cache: false,
            dataType: "json",
            success: function(Response) {

                //Process the response

            }
        });
    });

</script>

Apologies:

This module is currently unavailable.


Press enter to search