Home » Vinsight API  »  Advanced API Usage – Sending long OData Queries

Advanced API Usage – Sending long OData Queries


URLs have a limit on how long they are, you can use this technique to request OData queries that are longer than the max url length (2000 characters).

Basic Principles

Usually when performing an OData query against the API, you would do this by issuing a GET request with OData Query Parameters in the URL.

For example:

GET /SalesOrderItems?$filter=OrderNum eq 1000&$select=StockItem/StockItemCode, Quantity, UnitOfMeasureCode
Host: app.vinsight.net
Accept: application/json


However the same OData query can also be made by performing a POST request. Using a POST request means there is no character limit as the body of a POST can be a large as you need.
All you need to do is specify method=GET as the query parameter, then send the rest of the query as the POST body using text/plain.
Do not include the leading ? or & query seperator characters.

POST /SalesOrderItems?method=GET
Host: app.vinsight.net
Accept: application/json
Content-Type: text/plain

$filter=OrderNum eq 1000&$select=StockItem/StockItemCode, Quantity, UnitOfMeasureCode