Monet Knowledge Base

Monet Knowledge Base

API

Monet services

Estimated reading: 22 minutes 41 views

Introduction

Documentation and examples: https://documenter.getpostman.com/view/35957649/2sA3sAg7R9

 Services address: https://e.monetShark.com/DesktopModules/MonetServices2/API/v2/

username: demo
Password: demo321demo321

 
Services

 

Lists all the operations that the integrating system can use to get, change, write data, or call functions in the Monet environment. Operations are implemented on the basis of REST services: they are available by sending HTTP POST/GET/PUT requests. The following services are available:

 

 

    • Authorize()

 

    • GetCompanyList([int], [int], [string])

 

    • GetCurrencyCodeList([int], [int], [string])

 

    • GetCustInvoiceList([int], [int], [string])

 

    • GetCustList([int], [int], [string])

 

    • GetItemGroupList([int], [int], [string])

 

    • GetItemList([int], [int], [string])

 

    • GetItemTypeList([int], [int], [string])

 

    • getLanguage()

 

    • GetLocationList([int], [int], [string])

 

    • GetSalesInvoice(string)

 

    • GetTaxItemGroupList([int], [int], [string])

 

    • GetVendInvoiceList([int], [int], [string])

 

    • GetVendList([int], [int], [string])

 

    • PostPurch(PurchOrder)

 

    • PostSales(SalesOrder)

 

    • InsertCust(Customer)

 

    • InsertItem(Item)

 

    • InsertVendor(Vendor)

 

    • UpdateCust(Customer)

 

    • UpdateItem(Item)

 

    • UpdateVend(Vendor)

 

    • setLanguage(string)

 

 


Authorize()

 

Authorizes and returns the company name selected by the user.

 


GetCompanyList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Company objects.

 


GetCurrencyCodeList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Returns a list of CurrencyCode objects.

 


GetCustInvoiceList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of CustInvoice objects.

 


GetCustList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Customer objects.

 


GetItemGroupList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of ItemGroup objects.

 


GetItemList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Item objects.

 


GetItemTypeList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Returns a list of ItemType objects.

 


getLanguage()

 

Beautifies the language code.

 


GetLocationList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Location objects.

 


GetSalesInvoice(string)

 

Parameter: string invoiceId – invoice number. Refunds invoice in PDF format.

 


GetTaxItemGroupList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of TaxItemGroup objects.

 


GetVendInvoiceList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of VendInvoice objects.

 


GetVendList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Vendor objects.

 


PostPurch(PurchOrder)

 

A purchase account is registered, parameter PurchOrder order . Returns the account number.

 


PostSales(SalesOrder)

 

A sales invoice is registered, parameter SalesOrder order . Returns the account number.

 


InsertCust(Customer)

 

Writes a new customer, parameter Customer . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


UpdateCust(Customer)

 

Updates an existing customer, parameter Customer . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


InsertItem(Item)

 

Writes a new item, parameter Item . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


UpdateItem(Item)

 

Updates the current item, parameter Item . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


InsertVendor(Vendor)

 

Writes a new vendor, parameter Vendor . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


UpdateVend(Vendor)

 

Updates an existing vendor, parameter Vendor . Returns HttpStatusCode.OK or HttpStatusCode.NotAcceptable and an error message.

 


setLanguage(string)

 

A new client language is being set. Parameter – language code.

 


SetCompany(string)

 

A new customer company is being set up. Parameter – company code (3 characters).

 


GetServiceList([int], [int], [string])

 

Possible parameters: int _page = 0, int _size = 30, string _search = “”

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies the list of Service objects.

 


GetDimList([int], [int], [string])

 

Possible parameters: int _type, int _page = 0, int _size = 30, string _search = “”

 

_type – attribute type. 3 possible values: 0 – department, 1 – project, 2 – product.

 

_page – page number.

 

_size- page size.

 

_search – search phrase.

 

Beautifies a list of Dim objects.

 


PostPurchService(PurchServiceOrder)

 

A service purchase account is registered, parameter PurchServiceOrder order . Returns the account number.

 


PostSalesService(SalesServiceOrder)

 

Registering service sales account, parameter SalesServiceOrder order . Returns the account number.

 


PostLedgerJournal(LedgerJournalLine line)

 

Ledger operation is registered, parameter LedgerJournalLine line . Return the receipt number.

 


DeleteTrans(string voucher)

 

Deletes ledger transaction, parameter string voucher (receipt). Returns true if successful or false if not. Http Method – DELETE.

 


Objects

 

 Services return the following objects:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Company

 

Administered company

 

public class Company

 

    {

 

        public string ID { get; set; }

 

        public string Name { get; set; }

 

    }

 


CurrencyCode

 

Currency

 

public class CurrencyCode

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


CustInvoice

 

Sales invoice

 

public class CustInvoice

 

    {

 

        public string Invoice { get; set; }

 

        public string CustomerId { get; set; }

 

        public string CustomerName { get; set; }

 

        public DateTime Date { get; set; }

 

        public decimal InvoiceAmount { get; set; }

 

        public decimal TaxAmount { get; set; }

 

        public string Currency { get; set; }

 

    }

 


Customer

 

The client

 

public class Customer

 

    {

 

        public string ID { get; set; }

 

        public string Name { get; set; }

 

        public string EnterpriseCode { get; set; }

 

        public string VATNum { get; set; }

 

        public string Email { get; set; }

 

        public string Currency { get; set; }

 

        public string Address { get; set; }

 

        public string Phone { get; set; }

 

        public string Notes { get; set; }

 

    }

 


Item

 

Product

 

public class Item

 

    {

 

        public string ItemId { get; set; }

 

        public string Name { get; set; }

 

        public string Group { get; set; }

 

        public string Type { get; set; }

 

        public string TaxItemGroup { get; set; }

 

        public decimal Price { get; set; }

 

        public string Location { get; set; }

 

    }

 


ItemGroup

 

Product group

 

public class ItemGroup

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


ItemType

 

Product type

 

public class ItemType

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


Location

 

Warehouse

 

public class Location

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


Ledger


Ledger account

public class Ledger

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


Service

 

Service

 

public class Service

 

    {

 

       public string ServiceId { get; set; }

 

       public string Name { get; set; }

 

public string PurchLedgerAccount { get; set; }

 

public decimal PurchasePrice { get; set; }

 

public string PurchaseTaxItemGroup { get; set; }

 

public string SalesLedgerAccount { get; set; }

 

public decimal SalesPrice { get; set; }

 

public string SalesTaxItemGroup { get; set; }

 

    }

 


Dim

 

Symptoms

 

public class Dim

 

    {

 

        public int Type { get; set; }

 

 public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


PurchOrder

 

Purchase order

 

public class PurchaseOrder

 

    {

 

        public string VendorId { get; set; }

 

        public string PurchaseId { get; set; }

 

        public DateTime Date { get; set; }

 

        public DateTime DueDate { get; set; }

 

        public bool InclTax { get; set; }

 

        public string Notes { get; set; }

 

        public string InvoiceId { get; set; }

 

        public List<string> Dim { get; set; }

 

        public List<PurchServiceLine> PurchaseServiceLines { get; set; }

 

    }

 


PurchaseOrder.PurchOrderLine

 

Purchase order line

 

public class PurchaseOrderLine

 

        {

 

            public string PurchaseId { get; set; }

 

            public string ItemId { get; set; }

 

            public string Name { get; set; }

 

            public decimal Qty { get; set; }

 

            public decimal LinePercent { get; set; }

 

            public decimal Price { get; set; }

 

            public decimal Amount { get; set; }

 

            public string Location { get; set; }

 

            public string TaxItemGroup { get; set; }

 

        }

 


PurchaseServiceOrder

 

Service purchase order

 

public class PurchaseServiceOrder

 

    {

 

        public string VendorId { get; set; }

 

        public DateTime Date { get; set; }

 

        public DateTime DueDate { get; set; }

 

        public bool InclTax { get; set; }

 

        public string InvoiceId { get; set; }

 

        public List<string> Dim { get; set; }

 

        public List<PurchOrderLine> PurchaseOrderLines { get; set; }

 

    }

 


PurchaseServiceOrder.PurchServiceLine

 

Service purchase order line

 

public class PurchaseServiceLine

 

        {

 

            public string Name { get; set; }

 

            public decimal Amount { get; set; }

 

            public string ServiceId { get; set; }

 

            public string LedgerAccount { get; set; }

 

            public string TaxItemGroup { get; set; }

 

        }

 


SalesOrder

 

Sales order

 

public class SalesOrder

 

    {

 

        public string CustomerId { get; set; }

 

        public string SalesId { get; set; }

 

        public DateTime Date { get; set; }

 

        public DateTime DueDate { get; set; }

 

        public bool InclTax { get; set; }

 

        public string Notes { get; set; }

 

        public List<string> Dim { get; set; }

 

        public List<SalesOrderLine> SalesOrderLines { get; set; }

 

    }

 


SalesOrder.SalesOrderLine

 

Sales order line

 

public class SalesOrderLine

 

        {

 

            public string SalesId { get; set; }

 

            public string ItemId { get; set; }

 

            public string Name { get; set; }

 

            public decimal Qty { get; set; }

 

            public decimal LinePercent { get; set; }

 

            public decimal Price { get; set; }

 

            public decimal Amount { get; set; }

 

            public string Location { get; set; }

 

            public string TaxItemGroup { get; set; }

 

        }

 


SalesServiceOrder

 

Service sales order

 

public class SalesServiceOrder

 

    {

 

        public string CustomerId { get; set; }

 

        public DateTime Date { get; set; }

 

        public DateTime DueDate { get; set; }

 

        public bool InclTax { get; set; }

 

        public string Notes { get; set; }

 

        public List<string> Dim { get; set; }

 

        public List<SalesServiceLine> SalesServiceLines { get; set; }

 

    }

 


SalesServiceOrder.SalesServiceLine

 

Service sales order line

 

public class SalesServiceLine

 

        {

 

            public string Name { get; set; }

 

            public decimal Amount { get; set; }

 

            public string ServiceId { get; set; }

 

            public string LedgerAccount { get; set; }

 

            public string TaxItemGroup { get; set; }

 

        }

 


TaxItemGroup

 

Product VAT code

 

public class TaxItemGroup

 

    {

 

        public string Id { get; set; }

 

        public string Name { get; set; }

 

    }

 


VendInvoice

 

Purchase invoice

 

public class VendInvoice

 

    {

 

        public string Invoice { get; set; }

 

        public string CustomerId { get; set; }

 

        public string CustomerName { get; set; }

 

        public DateTime Date { get; set; }

 

        public decimal InvoiceAmount { get; set; }

 

        public decimal TaxAmount { get; set; }

 

        public string Currency { get; set; }

 

    }

 


Vendor

 

Supplier

 

public class Vendor

 

    {

 

        public string ID { get; set; }

 

        public string Name { get; set; }

 

        public string EnterpriseCode { get; set; }

 

        public string VATNum { get; set; }

 

        public string Email { get; set; }

 

        public string Currency { get; set; }

 

        public string Address { get; set; }

 

        public string Phone { get; set; }

 

        public string Notes { get; set; }

 

    }

 


LedgerJournalLine

 

Ledger journal line

 

public class LedgerJournalLine

 

    {

 

        public string Currency { get; set; }

 

        public string Account { get; set; }

 

        public int AccountType { get; set; }

 

        public decimal Debit { get; set; }

 

        public decimal Credit { get; set; }

 

        public DateTime Date { get; set; }

 

        public string Txt { get; set; }

 

        public string Profile { get; set; }

 

        public string DocumentNum { get; set; }

 

        public string AccountOffset { get; set; }

 

        public int AccountTypeOffset { get; set; }

 

    }

 

where the type of the AccountType and AccountTypeOffset fields is number. Its values ​​determine the nature of Account and AccountOffset

 

0 – Ledger

 

1 – Customer

 

2 – Vendor

 

5 – Fixed assets

 

6 – Bank

 

For example, if AccountType = 2, it means that the Account field contains a customer code (identifier).

 


Examples

 

API examples written in C#.

 


Creating a client

 

public async Task<HttpResponseMessage> InsertCust(Customer cust)

 

        {

 

            HttpClient httpClient = new HttpClient();

 

            HttpResponseMessage response = null;

 

            httpClient.DefaultRequestHeaders.Authorization =

 

                new AuthenticationHeaderValue(“Basic”,

 

                Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format(“{0}:{1}”, “demo”, “demo321”))));

 

                JavaScriptSerializer jss = new JavaScriptSerializer();

 

                string input = jss.Serialize(cust);

 

                var httpContent = new StringContent(input, Encoding.UTF8, “application/json”);

 

                response = await httpClient.PutAsync(“https://e.monetShark.com/DesktopModules/MonetServices2/API/v2/InsertCust”, httpContent);

 

                string answ = await response.Content.ReadAsStringAsync();

 

                if (response.IsSuccessStatusCode)

 

                {

 

                    …

 

                }          

 

            return response;

 

        }

 


Client list

 

public async Task<HttpResponseMessage> GetCustList(int _page = 0, int _size = 30, string _search = “”)

 

        {

 

            HttpClient httpClient = new HttpClient();

 

            HttpResponseMessage response = null;

 

            System.Collections.Generic.IList<Customer> customers;

 

            httpClient.DefaultRequestHeaders.Authorization =

 

                new AuthenticationHeaderValue(“Basic”,

 

                Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format(“{0}:{1}”, “demo”, “demo321”))));

 

            response = await httpClient.GetAsync(string.Format(“https://e.monetShark.com/DesktopModules/MonetServices2/API/v2/GetCustList?_page={0}&_size={1}&_search={2}”, _page , _size, _search));

 

            string answ = await response.Content.ReadAsStringAsync();

 

            if (response.IsSuccessStatusCode)

 

            {

 

                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(IList<Customer>));

 

                MemoryStream sss = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(answ));

 

                customers = (IList<Customer>)ser.ReadObject(sss);

 

            }

 

            return response;

 

        }