Woosmap for Flutter - API Services

Get access to Woosmap services for your native mobile developments on hybrid flutter development.

  1. Localities API
  2. Store Search API
  3. Distance API
  4. Transit API

The Woosmap API is a RESTful API built on HTTP. It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body.

Localities API

Woosmap Localities API is a web service that returns a great amount of geographical places in response to an HTTP request. Among others are city names, postal codes, suburbs, addresses or airports. Request is done over HTTPS using GET. Response is formatted as JSON. You must specify a key in your request, included as the value of a key parameter for your public key or private_key for your private key. This key identifies your application for purposes of quota management.

lib/service_snippet.dart
        LocalitiesAutocompleteRequest request = LocalitiesAutocompleteRequest(
input: "87 Rue montmatre",
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.localities.autocomplete(request).then((value) {
debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        LocalitiesDetailsRequest request = LocalitiesDetailsRequest(
publicId: "1234567890",
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.localities.details(request).then((value) {
debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        LocalitiesGeocodeRequest request = LocalitiesGeocodeRequest(
  address: "87 Rue montmatre",
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.localities.geocode(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        LocalitiesSearchRequest request = LocalitiesSearchRequest(
  input: "paris",
  types: [LocalitiesTypes.address, LocalitiesTypes.locality],
  components: LocalitiesComponentRestrictions(country: "fr"),
  location: LatLng(lat: 48.85, lng: 2.35),
  radius: 300,
  language: "fr",
  excludedTypes: [LocalitiesTypes.airport],
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.localities.search(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        LocalitiesNearbyRequest request = LocalitiesNearbyRequest(
  location: LatLng(lat: 48.85, lng: 2.35),
  radius: 300,
  type: LocalitiesNearbyTypes.pointOfInterest,
  page: 1,
  limit: 100,
  categories: [LocalitiesNearbyCategories.businessShop, LocalitiesNearbyCategories.businessFoodAndDrinks],
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.localities.nearby(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    

Store Search API

Stores Search API lets you search among your own Points of Interest. Find stores by geography, by attributes or by autocomplete on store names.

lib/service_snippet.dart
        StoresAutocompleteRequest request = StoresAutocompleteRequest(
query: "name:'My cool store'|type:'click_and_collect'",
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.stores.autocomplete(request).then((value) {
debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        StoresSearchRequest request = StoresSearchRequest(
    query: "idStore:31625406",
);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));

woosmapApi.stores.search(request).then((value) {
debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
debugPrint("An error occurred: ${error.message}");
});

    

Distance API

Distance APIs Is a set of APIs that provide distances, durations, routing and tolls information between start and end points. It can also be make isochrone calculations from a starting point.

lib/service_snippet.dart
        DistanceMatrixRequest request = DistanceMatrixRequest(
      origins: [LatLng(lat: 19.21034471165546, lng: 72.86760122219786)],
      destinations: [LatLng(lat: 18.99344303927699, lng: 72.82514876796016)],
      unitSystem: UnitSystem.metric,
      language: "fr",
      travelMode: DistanceTravelMode.driving,
      elements: DistanceElement.duration,
      method: DirectionMethod.distance,
      avoidTolls: true,
      avoidFerries: true,
      avoidZones: [
        [
          LatLng(lat: 19.072569055840898, lng: 72.84112306577242),
          LatLng(lat: 19.07131188628528, lng: 72.85241063283135),
          LatLng(lat: 19.058811510269383, lng: 72.85301871725203),
          LatLng(lat: 19.059637713632224, lng: 72.84142710798275),
        ]
      ],
      departureTime: "now",
    );

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));
woosmapApi.distance.distanceMatrix(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        DistanceRouteRequest request = DistanceRouteRequest(
        origin: LatLngLiteral(lat: 19.21034471165546, lng: 72.86760122219786),
        destination:
            LatLngLiteral(lat: 18.99344303927699, lng: 72.82514876796016),
        mode: DistanceTravelMode.driving,
        details: DistanceRouteDetails.full,
        method: DirectionMethod.distance,
        language: "fr",
        unitSystem: UnitSystem.metric,
        waypoints: DistanceWaypoints(points: [
          LatLngLiteral(lat: 19.061313061301266, lng: 72.85127892689086)
        ], optimize: true),
        avoidFerries: true,
        avoidHighways: false,
        avoidTolls: true,
        avoidZones: [
          [
            LatLng(lat: 19.072569055840898, lng: 72.84112306577242),
            LatLng(lat: 19.07131188628528, lng: 72.85241063283135),
            LatLng(lat: 19.058811510269383, lng: 72.85301871725203),
            LatLng(lat: 19.059637713632224, lng: 72.84142710798275),
          ]
        ],
        departureTime: "now",
        provideRouteAlternatives: true);

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));
woosmapApi.distance.route(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        DistanceTollsRequest request = DistanceTollsRequest(
        origin: LatLngLiteral(lat: 19.211813550966852, lng: 72.86491576857733),
        destination:
            LatLngLiteral(lat: 18.248663602443713, lng: 73.87807476531295),
        language: "en",
        unitSystem: UnitSystem.metric,
        arrivalTime: "1742365749");

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));
woosmapApi.distance.tolls(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    
lib/service_snippet.dart
        DistanceIsochroneRequest request = DistanceIsochroneRequest(
        origin: LatLngLiteral(lat: 19.061313061301266, lng: 72.85127892689086),
        value: 12,
        method: DirectionMethod.time,
        mode: DistanceTravelMode.driving,
        unitSystem: UnitSystem.imperial,
        avoidHighways: true,
        avoidTolls: true,
        language: "fr");

WoosmapApi woosmapApi = WoosmapApi(WoosKey(publicKey: "YOUR-PUBLIC-KEY"));
woosmapApi.distance.isochrone(request).then((value) {
  debugPrint(jsonEncode(value?.toJson()));
}).catchError((error) {
  debugPrint("An error occurred: ${error.message}");
});

    

Transit API

Transit API uses data provided by transit agencies (real time, timetables, average travel times) to build itineraries. In addition pedestrian mode can be proposed in itineraries to reach starting and ending points and commute between transportation modes

Route

Get distance, duration, path and public transport details between an origin and a destination, based on public transportation between those two points. This endpoint provides all the information needed to evaluate an itinerary.

Request parameters

lib/service_snippet.dart
          TransitRouteRequest request = TransitRouteRequest(
            origin: LatLngLiteral(lat: 45.467, lng: 9.0516),
            destination: LatLngLiteral(lat: 45.4599, lng: 9.2822),
            mode: [
              'highSpeedTrain',
              'intercityTrain',
              'interRegionalTrain',
              'regionalTrain',
              'cityTrain',
              'bus',
              'ferry',
              'subway',
              'lightRail',
              'privateBus',
              'inclined',
              'aerial',
              'busRapid',
              'monorail',
              'flight'
            ],
            departureTime: null,
            arrivalTime: null);

        WoosmapApi woosmapApi = WoosmapApi(WoosKey(
          privateKey: Platform.isAndroid
              ? AppConstants.of(context)?.privateKeyAndroid ?? ""
              : AppConstants.of(context)?.privateKeyiOS ?? "",
        ));

        woosmapApi.transit.route(request).then((value) {
          debugPrint(jsonEncode(value?.toJson()));
        }).catchError((error) {
          debugPrint("An error occurred: ${error.message}");
        });

    
Was this article helpful?
Have more questions? Submit a request