Contact me!
Eric Håård
+46 (0) 73 375 86 06

Example code

Some examples of how to use Storm Query

If you look at Product’s Metadata and find <EntityContainer Name=”Container”> then the EntitySets are listed below. 

Product skus

There is, among other things, ProductSkus. To get all ProductSkus in Storm this is the url:

https://services.enferno.se/Query/2.0/Products/ProductSkus

All links are also available at our Stage server: https://servicestage.enferno.se/Query/2.0. It should be used for testing.

If you look further into the metadata then you will find <EntityType Name=”ProductSku”>. There are all the columns that ProductSku has.
What appears as NavigationProperty is expandable properties. For example, ProductSku can be expanded with PriceLists.

This data can then be filtered with $filters, expanded with $expand and/or projected with $select.

In the Storm Query API, the access to data is locked to the application you log in as. This means that you only access data for one application at a time if it is not client-specific data. Then it is data common to all applications for that client.
In addition, all listing of data is limited to 500 pages. If you list all products and these are more than 500, you can make a new request to retrieve the following 500 products and continue until you have downloaded all.

Prices

Here’s an example of how to get all prices for all items where the price has changed since a certain date:

https://services.enferno.se/Query/2.0/Products/ProductSkus?$select=PartNo&amp;$expand=PriceLists($select=PriceListId,PriceSale,CurrencyId;$filter=PriceSaleLastUpdated gt 2016-08-01Z)&amp;$filter=PriceLists/any(p: p/PriceSaleLastUpdated gt 2016-08-01Z)

In the example above, use: $select to specify which columns you want, $expand to specify what you want for additional data and last use $filters to limit the amount of data to those who have PriceSaleLastUpdate after 2016-08-01 .

The Storm Query API today does not expose everything in Storm, but is expanded as needed. Missing something and we add it.
In use, it is important not to do too many questions unnecessarily, and preferably project data so that you only get what you need. In the future, we will monitor usage and charge per call or by data amount.

OData Client

There are several OData clients that will simplify development towards Storm Query. Here are some recommendations.

.NET: Simple.OData.Client

Simple OData client is a client that helps you with OData commands. It reads Storm Query metadata upon application start and helps you how to form your OData requests. Be sure to set ODataClientSettings.IgnoreUnmappedProperties = true so it won’t crash when we update Storm Query with metadata changes.

oDataClientSettings = new ODataClientSettings
{
    IgnoreUnmappedProperties = true,
    Credentials = new NetworkCredential
    {
        UserName = ConfigurationManager.AppSettings["OData.Storm.UserName"],
        Password = ConfigurationManager.AppSettings["OData.Storm.Password"],
    },
};
var client = new ODataClient(oDataClientSettings);