Mapbox: How many tiles were requested by this api key/account - mapbox

is there a way to request how many tiles were already requested this month for a given API key?
Or would I need a backend, to keep track?
On this side, I can see the requested tiles: https://account.mapbox.com/
But it only updates daily, not live.
Any help is appreciated.

There is a transformRequest option you can use when you instantiate the map. You could add code to it to trigger a counter somewhere else whenever a tile is requested.
See options.transformRequest here:
https://docs.mapbox.com/mapbox-gl-js/api/map/#map
Here is an example of how it is used: How to specify Authorization Header for a source in mapbox-gl-js?

Related

Azure data factory pagination doesn't work

I am working on a pipeline which executes oAuth2 flow in order to access REST API json data. Once I have the bearer token I am executing a request which returns the following structure:
As you can see, since the response is quite large, there's paging enabled and as part of the response I get a link to the next page. In order to get to that resource I need to also present MS-ContinuationToken in the headers. So, this is how I basically do it in the config of the Copy activity that I use to get the data from the REST endpoint:
and the issue here is that I only get the first 2000 rows and the next page(s) don't seem to be visited at all. Pipeline executes successfully and only the first 2000 items are fetched.
NOTE: continuationToken and links.next.headers.value have the exact same values from the initial response.
Even if you fix the other issue you’ll have an issue with the “next” URL not including “v1”. This is a known issue in the partner center api team. I’ve escalated it pretty high. But they don’t want to break backwards compatibility by changing the “next” URI to include the v1 or to be relative. They are considering other options but I wouldn’t hold your breath.
I would ditch the idea of using data factory and instead write a .NET console app using the partner center SDK
(You might think to paginate manually with loops etc but the Copy activity doesn’t return eg the http headers, so you will need a complex set up to somehow store the data in a data store and be able to look up the last page in order to get the continuation token. I couldn’t figure it out)

How to get the actual drop location(not the destination) of a Uber Ride via API, after the ride completes?

I can see the my actual drop location on the receipts page on riders.uber.com, but do not see that data in requests/{request_id}/receipt/ end point of the API. Is there an alternative to get this data ?
I see that a GET on requests/{request_id}/ gives the actual location of the a ride, but does this point also gives the same data on ride completion/cancellation ? On sandbox-api, on completion of ride, I get location as null, on a GET requests/{request_id}/ call
The Uber API doesn't expose this information. It provides the destination of a trip in the request details, but it does not update the destination based on the actual drop-off location.
As pointed out in the comments, ONE partial alternative for this use case might be to use the request details array of waypoints. However, it is only available for shared rides like UberPOOL.

Other RESTful actions on a resource

Lets say I have resource representing images
PUT /images/[id] with path -> going to create me a new image resource if already present updates my resource
POST /images/[id] -> to change or update a resource Ex., image name
DELETE /images/[id] -> this will delete my resource
GET /images/[id] -> gets me the image details
Now the actual question. what if I need to add additional actions to the images ?. Lets say the image resource will respond to a red eye reduction action or any other like crop, resize
So how these action are considered and how this should be called in restful interface ?
/images/[id]/remove_redeye
/images/[id]/crop
/images/[id]/resize
Is the above calls valid in restful interface ? I am confused about what should these action should be considered(PUT POST)?
"Remove redeye", "crop", and "resize" all sound like actions which "change or update a resource." They would belong in a PUT action. (I think you mixed up PUT and POST in your question, refer to the verbs listed at w3c.)
How you convey the nature of the action depends on what's being POSTed. For example, if we were talking about a form sitting on top of a database record, the POST would simply be the data for that record. It wouldn't be necessary to specify which fields are being changed because the whole object is being POSTed in its new state.
Is the whole object being POSTed in its new state in this case? Or does the object live only server-side and the interface is just sending a request for some kind of action? It sounds like the latter to me, based on the information provided.
In that case you can include in the POST some more information about the action. Keep in mind that a POST can contain key/value pairs in its data and/or a larger and more complex POST body. This body can contain XML, for example, specifying a lot more information for the server to use in processing the request. Maybe something like this:
<image id="123">
<resize>
<width>200</width>
<height>200</height>
</resize>
</image>
This could even allow multiple actions within the same request, allowing the user to try various things client-side before committing them all in a single unit of work server-side. How you'd process that or if it's even applicable in this case is up to you, of course.
PUT /images/[id] means to add a new resource or to fully replace an existing one.
POST means to create (/images) or to modify a resource (/images/[id]). If you create a resource, the server may return that resource for you.
For several modifying actions on the same resource (POST), I tend to use a custom header to define the kind of modification. In this case your resources
/images/[id]/remove_redeye
/images/[id]/crop
/images/[id]/resize
would translate to:
POST /images/[id] HTTP/1.1
X-RESTAction [remove_redeye|crop|resize]

Bing maps: Direct Access to tiles and Api key

i am using Bing map tiles in my Android application. I download tiles from http://h0.ortho.tiles.virtualearth.net/tiles/h<quadkey>.jpeg?g=131 and it works fine, but i understand that i need to append a token to this URL in order to make this operation legal (and ask some kind of special permission from Microsoft). It is all well explained here: http://blogs.msdn.com/b/virtualearth/archive/2008/04/29/tracking-virtual-earth-tile-usage.aspx. But this post is from 2008 and i found on msdn site that in 2012, token-auth system will be replaced with key auth system.
Does anybody know how can i perform the direct tile access with this new auth system?
Thanks in advance
Accessing tiles directly with key-based authentication can be accomplished like so:
Using the REST ‘Get Imagery Metadata’ service to obtain the tile URL format for the type of tiles you wish to display:
http://msdn.microsoft.com/en-us/library/ff701716.aspx
- For example, if you wish to display Road tiles, the following request could be used (taken from the above documentation): http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Road?mapVersion=v1&output=xml&key=BingMapsKey
Within the response, the URL for tiles is returned, with a placeholder for the tile quadkey.
A new REST request should be issued each time the map viewer in the application is instantiated, or whenever the map type is changed (eg. You wish to switch to aerial or hybrid map style)
Your platform usage can then be tracked based on the calls to the REST service.

google analytics api fails to return segment data

I'm trying to use Google Analytics API to retrieve data for my custom segments.
They say here http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html#accountResponse that all the segments are listed in the account feed response. But mine doesn't contain them.
Has anyone else had this problem and know a way to get the data out from them?
Thanks,
Beth
Make sure you add GData-Version: 2 in your header.