Woosmap for React Native - API Services
Get access to Woosmap services for your native mobile developments on hybrid React Native development.
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
input
: The text string on which to search, for example: “london”types
: “locality” “postal_code” “address” “admin_level” “country” “airport” “train_station” “metro_station” “shopping” “museum” “tourist_attraction” “amusement_park” “art_gallery” “zoo”components
: A grouping of places to which you would like to restrict your results. Components can be used to filter over countries.language
: The language code, using ISO 3166-1 Alpha-2 country codes, indicating in which language the results should be returnedlocation
: This parameter is used to add a bias to the autocomplete feature. The location defines the point around which to retrieve results in priority.radius
: This parameter may be used in addition to the location parameter to define the distance in meters within which the API will return results in priority.data
: Two values for this parameter: standard or advanced. By default, if the parameter is not defined, value is set as standard. The advanced value opens suggestions to worldwide postal codes in addition to postal codes for Western Europe. A dedicated option subject to specific billing on your license is needed to use this parameter.extended
:If set, this parameter allows a refined search over locality names that bears the same postal code.customDescription
: This parameter allows to choose the description format for all or some of the suggestion types selected. The custom formats are described as follows (available fields depend on the returned type):custom_description=type_A:"{field_1}, {field_2}, [...]"|type_B:"{field_1}, {field_2}, [...]"
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
publicId
: A textual identifier that uniquely identifies a locality, returned from a Localities Autocomplete.language
: The language code, using ISO 3166-1 Alpha-2 country codes, indicating in which language the results should be returnedfields
: Used to limit the returning fields, default it is geometrycountryCodeFormat
: To specify the format for the short country code expected to be returned in the address_components field (default is alpha3).
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
address
: The input string to geocode. Can represent an address, a street, a locality or a postal code.latLng
: The latlng parameter is used for reverse geocoding, it’s required if the address parameter is missing.components
: A grouping of places to which you would like to restrict your results. Components can be used to filter over countries. Countries must be passed as an ISO 3166-1 Alpha-2 or Alpha-3 compatible country code.language
: The language code, using ISO 3166-1 Alpha-2 country codes, indicating in which language the results should be returnedfields
: Used to limit the returning fieldsdata
: Two values for this parameter: standard or advanced. By default, if the parameter is not defined, value is set as standard. The advanced value opens suggestions to worldwide postal codes in addition to postal codes for Western Europe. A dedicated option subject to specific billing on your license is needed to use this parameter.countryCodeFormat
: To specify the format for the short country code expected to be returned in the address_components field.
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
query
: Search query combining one or more search clauses. Example:query=name:'My cool store'|type:'click_and_collect'
language
: The preferred language to match against name (defaults on Accept-Language header)limit
: You can then request stores by page usinglimit
parameters
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
query
: Search query combining one or more search clauses. Example:query=name:'My cool store'|type:'click_and_collect'
latLng
: To bias the results around a specific latlngradius
: To bias the results within a given circular area.polyline
: Find stores nearby an encoded polyline and inside a defined radius.storesByPage
: You can then request stores by page usingpage
andstoresByPage
parameters (Default is 100, max is 300).page
: Page number when accessing paginated storeszone
: whether to search for stores intersecting a zone
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)}`
);
});