Bing maps Rest API objects not the same - bing-maps

I need to create an API services that calls Bing maps Rest API gets Address, Elevation and latitude and longitude values.
I see that there a Autosuggest that returns an Address object, I also see you have Find location by address api that also returns an Address object. My question is why both address object are not the same? and can it be the address adding the missing fields ?
As I need all the values from the address object from Autosuggest .I would like to call the Find location by address api and get a list of address with the latitude and longitude values as well. Currently I making 3 api calls

The autosuggest and Location APIs, do use the same Address class/object, however this is a lower-level property of the main response from each API.
The autosuggest API returns an autosuggest response that can contain a LocalBusiness, Place, or Address object. All of these have an address property that is an Address object. The __type property in these responses provide an additional insight on the type of result.
The location APIs, return a Location object that has an address property that is the same Address object used in the autosuggest API.
There are some differences in the response objects, but they all include the same Address object.
The autotsuggest responses do not include location details such as latitude/longitude as this information has a higher cost and including this information would mean this service would have to have the same cost per request as the Location API. By separating out this information, the Autosugget API only generates a 1/10th of a transaction per request (10 times cheaper than the Location API). Since in a normal autosuggest experience, a user will likely generate 5 to 10 requests to this service, when typing a single input, this makes the overall cost of this experience significantly cheaper. If each request was charged a full transaction, most companies would quickly find the cost of this experience to be extreme.
For your scenario, the expectation would be atleast 3 requests as defined below.
One or more to the autosuggest API with the users input.
One taking the formattedAddress value from the Address object in the autosuggest response and passing it into the location query API to get the latitude/longitude details.
One taking the latitude/longitude information into the elevation API. Note you can pass in multiple points into this API, and thus get the elevations for an array of address coordinates.

Related

Filtering certain coins based upon name with CoinMarketCap

I'm currently attempting to use the CoinMarketCap API but finding it frustrating.
I'm wanting to use this URL to query their API:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest
However, rather than finding all, or just simply filtering based upon the number, I want to find a certain few coins.
So for example, I want to only find Bitcoin, Ethereum and Cardano.
Looking at their docs, it suggests you can sort by name, but it appears this is only listing them alphabetically, which I don't want to do.
So can anyone suggest how to query their API successfully and find just Bitcoin, Ethereum and Cardano using that GET URL above?
Here's the URL to the specific URL for the API request: https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyListingsLatest
For this purpose, you can use the endpoint Quotes Latest:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest
It allows you to pass a list of identifiers in a string as a parameter, like this:
1,1027,328
or a list of slugs:
bitcoin,ethereum,monero
or a list of symbols
BTC,ETH,XMR
If you trying to scrape information about new listings at crypto exchanges, you can be interested in this API:
https://rapidapi.com/Diver44/api/new-cryptocurrencies-listings/
It includes an endpoint with New Listings, New Pairs from the biggest exchanges and a very useful endpoint with information about exchanges where you can buy specific coins and prices for this coin at that exchange. It's a bit paid, but it's worth it!

Salesforce - Reverse lookup geo into an address

I am struggling with this, at the moment we have an application that sends the Lat and Long to Salesforce which we store in two seperate geo code fields.
For example
Subscriber_lat = latitude
Subscriber_long = longitude
We need this converted to
Address = 14 Street Name Street, Suburb, State, Country, Postcode
The problem we have is we want to convert this to an address so we can report on it (e.g. Suburbs, States etc)
Does anyone know of a solution here?
Michael
A service such as Google Map's API can do this.
Reverse Geocoding (Address Lookup) The term geocoding generally refers
to translating a human-readable address into a location on a map. The
process of doing the opposite, translating a location on the map into
a human-readable address, is known as reverse geocoding.
Required parameters in a reverse Geocoding request:
latlng — The latitude and longitude values specifying the location for
which you wish to obtain the closest, human-readable address.
key — Your application's API key. This key identifies your application
for purposes of quota management.

HTTP request to search for multiple ObjectIds in a Mongo-based API?

I'm looking to add search functionality to an API, on a resource called Organizations. Organizations can have different Location and Audience ids tagged onto them (which I would like to use in searching). Since these ids are MongoDB ObjectIds, they are quite long and I'm worried about reaching the max query string limit of the browser with a GET request. For example:
GET http://my-site.com/api/organizations?locations=5afa54e5516c5b57c0d43227,5afa54e5516c5b57c0d43226,5afa54e5516c5b57c0d43225,5afa54e5516c5b57c0d43224&audiences=5afa54e5516c5b57c0d43223,5afa54e5516c5b57c0d43222
Which would probably be about an average search, however I don't want it to break if users select many Locations or Audiences.
Any advice on how I could handle this situation?
I've ran into your situation before. You can change your method to POST
For a input of locations and audiences, your resource is not already sitting there. You have to compute it.
By the definition of POST:
Perform resource-specific processing on the request payload.
Providing a block of data, such as the fields entered into an HTML
form, to a data-handling process;
You have to compute and create new resource for response. So it's REST-compliance to do so.

Bing Maps REST API Basic key returns different results than Enterprise key

This unstructured format
http://dev.virtualearth.net/REST/v1/Locations?addressLine=3712%20Adelaide&adminDistrict=TX&locality=The%20Colony&countryRegion=US&postalCode=75056&maxRes=1&key=YourKey
does not seem to return the same result as this structured format
http://dev.virtualearth.net/REST/v1/Locations/US/TX/75056/The%20Colony/3712%20Adelaide?o=json&key=YourKey
The structured format is returning high confidence and the unstructured format is returning medium. What am I missing?
Edit: I never would have expected this. I have discovered the unstructured format returns medium confidence with my current API key and returns high confidence with a new trial key. What does this mean?
Trying the URL's you provided I see the exact same results with the same high confidence value.
Here is the response from the Microsoft Bing Team:
Issue Definition: Question regarding Bing Maps REST Location API service. Scope Agreement: As per our communication, you provided a query for 3712 Adelaide, The Colony, TX 75056 with the Bing Maps REST Location API with a Basic and Enterprise key and received different results and you would like to know the reason. The reason you are receiving different results is because we are in the middle of deploying new information to the Bing Maps REST geocoder. This information is first flighted on Basic (free) accounts before it is released to Enterprise customers.
Our Product Group let us know that it should be deployed to all Enterprise customers by the end of this month.

Generating a secure key that restricts a user to a particular radius

I was thinking of using Algolia's Secured API Keys feature to limit my users' queries to a particular geographic area (e.g., 50 miles around their home location). The idea was that users shouldn't be able to search the entire system, only the part of it that is relevant to them, thus limiting overall exposure of database. Does the API support anything like this, or do I need to use the tagging feature to do something less specific, e.g., tagging records by the user's home state ("New York") and then restricting access based on that tag?
you should be able to do so by generating a specific API key with pre-filled search parameters for each of your user.
Each key will have a specific around lat lng parameter and a specific radius also.
The user will not be able to trick the key to use different pre-filled search parameters. But you can still use different parameters (that were not pre-filled).
First, you need to create a new search only api key in your dashboard.
Then, using the JavaScript (node.js) client for instance:
var public_key = client.generateSecuredApiKey('YourSearchOnlyApiKey', {aroundLatLng: '43.0909,23.99898', aroundRadius: 50 * 1000});
Then on the frontend, in the browser, using this new api key, your user will only be able to search for items around the provided latitude longitude with a 50km radius.
You can use any geo search parameter https://www.algolia.com/doc/rest#geo-search-parameters.
More infos:
https://www.algolia.com/doc/tutorials/security
https://github.com/algolia/algoliasearch-client-js#security--user-api-keys
Every other API client has the same paragraph.