Megaventory API v2017a

<back to all web services

WeightUnitGet

The following routes are available for this service:
GET POST/WeightUnit/WeightUnitGetGets information on existing weight unitsUses your API Key and some Filters in an array format and returns the search results using 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 WeightUnitID descending order.

Examples:



A.

Get all the existing weight units (as mvWeightUnit objects).

Value:

{}


Response:

{
   "mvWeightUnits": [
        {
            "WeightUnitID": 3,
            "WeightUnitAbbrev": "lb",
            "WeightUnitName": "Pound(s)",
            "WeightUnitConversionToGrams": 453.592370000
        },
        {
            "WeightUnitID": 2,
            "WeightUnitAbbrev": "oz",
            "WeightUnitName": "Ounce(s)",
            "WeightUnitConversionToGrams": 28.349523125
        },
        {
            "WeightUnitID": 1,
            "WeightUnitAbbrev": "g",
            "WeightUnitName": "Gram(s)",
            "WeightUnitConversionToGrams": 1.000000000
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "0"
    }
}


B.

Returns the first mvWeightUnit object with a WeightUnitName that contains "ou" with an abbreviation which contains the letter "b".
We can add two Filters by using the AndOr operator as shown below:

Value:

 {
   "Filters": [
        {
            "FieldName": "WeightUnitName",
            "SearchOperator": "Contains",
            "SearchValue": "ou"
        },
        {
            "AndOr": "And",
            "FieldName": "WeightUnitAbbrev",
            "SearchOperator": "Contains",
            "SearchValue": "b"
        }
    ],
    "ReturnTopNRecords": 1  
}


Response:

{
   "mvWeightUnits": [
        {
            "WeightUnitID": 11,
            "WeightUnitAbbrev": "lb",
            "WeightUnitName": "Pound(s)",
            "WeightUnitConversionToGrams": 453.592370000
        }
    ],
    "ResponseStatus": {
        "ErrorCode": "0"
    }
}

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

HTTP + CSV

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

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

AndOr,Group,FieldName,SearchOperator,SearchValue
And,Undefined,String,Undefined,String

HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

WeightUnitID,WeightUnitAbbrev,WeightUnitName,WeightUnitConversionToGrams
0,String,String,0