Javascript API

Datasource

Interact with your data set

Woosmap Locator API provides a DataSource object that you need to use to fetch your assets from our API end point.

The Datasource does not need any parameters, just create a new object and it will automatically connect to our API. Then you just have to use it to fetch all or some assets.

var dataSource = new woosmap.DataSource();

dataSource.searchStoresByParameters(
    new woosmap.SearchParameters({
        page: 1,
        storesByPage: 25
    }),
    function (data) {
        //Stores are contained in data.feature
    });

dataSource.searchStoresByParameters(
    new woosmap.SearchParameters({
        lat: 43.6,
        lng: 3.883,
        storesByPage: 10
    })
    , function (data) {
    //Here you get the 10 stores closest to the lat/lng provided
    //Each stores will have an extra field 'distance' from the lat/lng point.
});

dataSource.getStoreById(12, function (data) {
    //Get the store with the ID 12
});

To see what the Datasource Object returns, take a look at the sample API response in Data API section.