Megaventory API v2017a

<back to all web services

CurrencyGet

The following routes are available for this service:
GET POST/Currency/CurrencyGetGets information on current currenciesUses your API Key and some Filters in an array format and returns the search results using the given filters. Optionally, you can use ReturnTopNRecords to limit the number of the results to the specified number (omit, or add ReturnTopNRecords = -1 to get all the available results). The ReturnTopNRecords chooses the top records in a DiscountID descending order.

Examples:



A.


Get all the current currencies (as mvCurrencies objects).

Value:

{}


Response:

 {
         "mvCurrencies": [
            {
               "CurrencyId": 22,
               "CurrencyCode": "DZD",
               "CurrencyDescription": "Algerian Dinar (DZD)",
               "CurrencySymbol": "din",
               "CurrencyIsDefault": false,
               "CurrencyInReports": false
            },
            {
               "CurrencyId": 21,
               "CurrencyCode": "EUR",
               "CurrencyDescription": "Euro (EUR)",
               "CurrencySymbol": "EUR",
               "CurrencyIsDefault": false,
               "CurrencyInReports": true
            },
            {
               "CurrencyId": 20,
               "CurrencyCode": "USD",
               "CurrencyDescription": "US Dollar (USD)",
               "CurrencySymbol": "USD",
               "CurrencyIsDefault": true,
               "CurrencyInReports": true
            }
         ],
         "ResponseStatus": {
            "ErrorCode": "0"
         }
    }


B.

Returns the first 10 mvCurrency objects with CurrencyID greater than 2 whose description contains the word "Euro".
We can add two Filters by using the AndOr operator as shown below:

Value:

 {
   "Filters": [
      {
         "FieldName": "currencyID",
         "SearchOperator": "GreaterThan",
         "SearchValue": 2
      },
      {
         "AndOr": "And",
         "FieldName": "currencydescription",
         "SearchOperator": "Contains",
         "SearchValue": "Euro"
      }
   ],
   "ReturnTopNRecords": 10

}


Response:

 {
   "mvCurrencies": [
      {
         "CurrencyId": 21,
         "CurrencyCode": "EUR",
         "CurrencyDescription": "Euro (EUR)",
         "CurrencySymbol": "EUR",
         "CurrencyIsDefault": false,
         "CurrencyInReports": true
      }
   ],
   "ResponseStatus": {
      "ErrorCode": "0"
   }
}

To override the Content-type in your clients HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/CurrencyGet HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/jsv
Content-Length: length

{
	Filters: 
	[
		{
			AndOr: And,
			Group: Undefined,
			FieldName: String,
			SearchOperator: Undefined,
			SearchValue: String
		}
	],
	ReturnTopNRecords: 0,
	APIKEY: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	mvCurrencies: 
	[
		{
			CurrencyId: 0,
			CurrencyCode: String,
			CurrencyDescription: String,
			CurrencySymbol: String,
			CurrencyIsDefault: False,
			CurrencyInReports: False
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String
			}
		]
	},
	InternalErrorCode: String
}