Woosmap for React Native - API Services

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

  1. Localities API
  2. Store Search 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.

Autocomplete for Localities

Autocomplete on worldwide suggestions for a for text-based geographic searches. It can match on full words as well as substrings. You can therefore send queries as the user types, to provide on-the-fly city names, postal codes or suburb name suggestions.

Request parameters

src/plugin_snippet.tsx
          let api = new WoosmapApi({ publicKey: <<public key from woosmap console>> }); //or new WoosmapApi({ privateKey: <<private key from woosmap console>> });
  let apiInput: LocalitiesAutocompleteRequest = { input: 'landon' };
  api.Localities.autocomplete(apiInput)
          .then((apiResult) => {
            console.log(JSON.stringify(apiResult, undefined, 4));
          })
          .catch((error) => {
            console.log(
              `${error.message} \n\n ${JSON.stringify(error.cause, undefined, 4)}`
            );
          });

    

Details of a Locality

Provides details of an autocomplete suggestion (using the suggestion’s publicId).

Request parameters

src/plugin_snippet.tsx
          let api = new WoosmapApi({ publicKey: <<public key from woosmap console>> }); //or new WoosmapApi({ privateKey: <<private key from woosmap console>> });
  let apiInput: LocalitiesDetailsRequest = { publicId: '123456' };
  api.Localities.autocomplete(apiInput)
          .then((apiResult) => {
            console.log(JSON.stringify(apiResult, undefined, 4));
          })
          .catch((error) => {
            console.log(
              `${error.message} \n\n ${JSON.stringify(error.cause, undefined, 4)}`
            );
          });

    

Geocode a locality or Reverse Geocode a latlng

Provides details for an address or a geographic position. Either parameter address or latlng is required.

Request parameters

src/plugin_snippet.tsx
          let api = new WoosmapApi({ publicKey: <<public key from woosmap console>> }); //or new WoosmapApi({ privateKey: <<private key from woosmap console>> });
  let apiInput: LocalitiesGeocodeRequest = {address: '123 gold gym'};
  api.Localities.geocode(apiInput)
          .then((apiResult) => {
            console.log(JSON.stringify(apiResult, undefined, 4));
          })
          .catch((error) => {
            console.log(
              `${error.message} \n\n ${JSON.stringify(error.cause, undefined, 4)}`
            );
          });

    

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.

Autocomplete for assets

Autocomplete on localizedNames with highlighted results on asset name. Use the field localized in your query parameter to search for localized names.

Request parameters

src/plugin_snippet.tsx
          let api = new WoosmapApi({ publicKey: <<public key from woosmap console>> }); //or new WoosmapApi({ privateKey: <<private key from woosmap console>> });
  let apiInput: StoresAutocompleteRequest = {query:'name:\'My cool store\'|type:\'click_and_collect\''};
  api.Stores.autocomplete(apiInput)
          .then((apiResult) => {
            console.log(JSON.stringify(apiResult, undefined, 4));
          })
          .catch((error) => {
            console.log(
              `${error.message} \n\n ${JSON.stringify(error.cause, undefined, 4)}`
            );
          });

    

Search for assets

Used to retrieve assets from query.

Request parameters

src/plugin_snippet.tsx
          let api = new WoosmapApi({ publicKey: <<public key from woosmap console>> }); //or new WoosmapApi({ privateKey: <<private key from woosmap console>> });
  let apiInput: StoresSearchRequest = {query:'idStore:31625406'};
  api.Stores.search(apiInput)
          .then((apiResult) => {
            console.log(JSON.stringify(apiResult, undefined, 4));
          })
          .catch((error) => {
            console.log(
              `${error.message} \n\n ${JSON.stringify(error.cause, undefined, 4)}`
            );
          });

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