Speed limit does not work, but snap to roads and the other features does - google-roads-api

When I access this link : https://roads.googleapis.com/v1/speedLimits?path=38.75807927603043,-9.03741754643809|38.6896537,-9.1770515|41.1399289,-8.6094075&key=YOUR_API_KEY for google ROADS API it gives me the following error :
{
"error": {
"code": 403,
"message": "Speed limits are not available for this project.",
"status": "PERMISSION_DENIED"
}
}
I need to mention that the other links work (for snap to roads, nearest roads). Only this one throws and error. I made sure to enable the ROADS API in the dashboard and I checked the documentation where they talked about the reason for getting this type of error (and none of their fixes helped so far).

From the note at the top of the documentation page:
Notice: The Speed Limit service is available to all customers with an Asset Tracking license. For Google Maps Platform Premium Plan customers who transitioned to pay-as-you-go pricing, the Speed Limit feature remains active on projects with Asset Tracking capabilities (projects with a project ID in the format maps-asset-xxx).
https://developers.google.com/maps/documentation/roads/speed-limits

Related

Retrieve "Shopify Payments" fees by Order # for reconciliation with Accounting + Bank Deposits?

Reconciling deposits, within an accounting system, coming into a Shopify User's bank account from a Shopify store running Shopify Payments (or otherwise) appears to be one of the things people frequently stumble on — based on the number of requests about the topic on Shopify's Support Community Forums, for example: https://community.shopify.com/c/Shopify-APIs-SDKs/Fees-charged-by-Shopify-via-API/m-p/265261/
The issue (for accounting) is that Shopify Payments removes the Fee Amount (for a full list of fees see: https://www.shopify.com/pricing) prior to depositing the balance of the transaction into a Store Owner's bank account.
Shopify Fees generally look something like: 2.6% of transaction value + $0.30
Calculation of the fees that should be taken out based on the above is pretty simple (hard code the fee schedule), until those fees change at some point in the future.
How does this impact Integrations?
For many of the available simple integrations this causes a discrepancy between the invoice amount of money hitting the bank account and the amount of money we 'Expect' to hit the bank account based on the Shopify Invoice Amount that is readily retrieved via Shopify's API by many such solutions.
That discrepancy means that it is necessary for an Accounting based user to manually deduce which Shopify Invoice is associated with which incomming bank deposit — and then manually add a negative line item to account for the difference / balance the books.
This is the suggested methodology coming from several different Accounting System / Software vendors (specifically Xero and Quickbooks) when asked how their customers solved the above issue.
I know that there are solutions out there that attempt to solve all of the above problems (with varying degrees of success), but due to the amount of Kitting that my current situation involves none of them adequately solve the other required functionality for our business.
We need to be able to find the fees (or alternately calculate them ourselves) and add those fees to the invoice so our accounting system is expecting the correct amount of funds to hit our bank account — hence the question: How can we retrieve the current accounts "Shopify Payments" fees / rates.
Ideally I want to avoid hard coding this information since Shopify likely does change the fees (potentially with only minor notification) meaning that at that point our integration would break. It would be much better to be able to retrieve the fee schedule for a given account via API request thereby avoiding issue if the fees change.
I have multiple clients who are also facing the same issue — so I figured it was worth checking to see if anyone has faced / solved the problem, and discuss my current solution
What does Shopify Say?
Generally their comment is that there is no road map to including the fees deducted from an invoice when responding to an API Request as taken from: https://community.shopify.com/c/Shopify-APIs-SDKs/Fees-charged-by-Shopify-via-API/m-p/265261/ (which seems strange) — meaning that 'wont do' is the best classification for the feature request that would provide this information with simple / readily available calls to the currently available API Endpoints.
Without access to Fee amounts on a per order basis I am not sure how Shopify Stores are currently interfacing with their account systems.
I would love to hear solutions from any Shopify user who may have encountered this issue previously! I opened a ticket request with support so I will see what I get back over there as well and post back.
OK so this isn't a total solution but I am updating as I go and will continue to edit this answer until I find a full solution (or until someone who has one adds an answer).
Whitelist / API Endpoint Approval Required
I found a Shopify API endpoint that should give the information I am looking for over here: https://help.shopify.com/en/api/reference/shopify_payments/transaction
According to the Shopify API docs the response should contain the Fee Amount and the API Endpoint would be:
/admin/shopify_payments/balance/transactions.json
That would get me exactly what I need, except that sending a properly formatted request to the avoid Endpoint gives the following response:
{
"errors": "[API] This action requires merchant approval for read_shopify_payments_payouts scope."
}
Basically it seems like it needs to be approved per merchant making it a less than ideal solution for you guys as an App. I requested the functionality and will add to this if it makes something easier (when / if it's granted to our account).
Public Access to Similar Fee Data
While playing around with some of the other endpoints I ran into this one (which IS public and accessible for Apps — I am a partner / develop Shopify Apps myself) which seems to provide similar functionality:
https://help.shopify.com/en/api/reference/orders/transaction
When making a call (and receiving the "kind": "sale" result for a given Order Id) I get the following pieces of JSON that are interesting:
"gateway": "shopify_payments",
"status": "success",
and more importantly:
"balance_transaction": {
"id": "XXXXXXXXXX",
"object": "balance_transaction",
"amount": 12881,
"available_on": 1553040000,
"created": 1552943224,
"currency": "usd",
"description": "XXXXX#outlook.com",
"exchange_rate": null,
"fee": 339,
"fee_details": [
{
"amount": 339,
"application": "ca_1vQrdCwnvOuC2Ypn5R9whwXkGxb4XJjx",
"currency": "usd",
"description": "Shopify Payments application fee",
"type": "application_fee"
}
],
Where the JSON 'amount; property corresponds to the invoice sales amount (including shipping) as a decimal free value.
The "fee": 339 appears to indicate the fee amount deducted by Shopify Payments (based on the JSON idicator attached: description": "Shopify Payments application fee").
Yep. That's the Fee.
After checking the Shopify Account tier (in this case Advanced) the fees deducted should be: 2.4% + 30¢ meaning that the total does match — 2.4% * $128.81 = $3.09144 + 30 cents (per transaction) = $3.39.
So basically everything exists (with no whitelisting required) to get the fee amounts on a per order basis for Shopify Payments users. This probably includes the Shopify Fees charged to external gateways as well although I don't use one so I can't say for sure.
That endpoint functionality means Shopify Fees likely COULD be added to any Shopify App that integrates with an accounting system — but also means it is relatively easy to pull in after the fact if the integration you are working with deposits the Invoiced amount into accounting but DOES NOT add a negative line item associated with the Shopify Fees — like mine does.
Still leaves me with some questions but at least the initial 'How do I find the Shopify Fees?' question is taken care of.
Previously my scripts that handle our accounting had used the Shopify API. As one commenter mentioned this API no longer works (or has changed in some way I have not found a solution to)
For everyone who is now having trouble with the API changes and doesn't mind a slightly manual solution to grab all Shopify payouts information you can dump a CSV out of the Shopify Payouts view, and then load that into your script (or alternately into Google Drive, and then hit that as a database... for example with Autocode's Standard Library).
To export Shopify Payouts data in CSV:
Go to the Shopify Payouts page for your Shopify store: https://XXX-YOURURL-XXX.myshopify.com/admin/payments/payouts
Set your date range / filter range to make sure you are exporting the correct payout date range.
Click the Export button in the top right hand corner, to the left of Documents and Transactions.
Shopify will email you the exported Transaction CSV which you can then do with what you like. This process won't work so well for anyone who is attempting to use a daily payout reconciliation strategy within their accounting system, but for the rest of us peons who are further behind on reconciliation it works well.

push telemetry to thingsboard asset

I've trying to setup ThingsBoard for a few days and up to now it's going well. I'm stuck on how to push attributes (sometimes in an aggregate mode - avg, sum, etc) and telemetry data from a Device to its related asset.
Any simple way to do it? I didn't find any API for such.
Thanks
The following is the API for pushing telemetry data for asset, but you also need to be atleast a customer user to use the api i.e need to set authorization token in header as x-authoization: Bearer {JWTtoken}
API: /api/plugins/telemetry/ASSET/{assetId}/timeseries/SERVER_SCOPE/
method : POST
request(example):
{
"ts": 1563456910227,
"values": {
"longitude": "78.381984",
"latitude": "17.448645",
"fuel": "30",
"speed": "42",
"vehicleType": "bus",
"status": "On route"
}
}
Thingsboard supports MQTT, CoAP and HTTP. See https://thingsboard.io/docs/user-guide/telemetry/#device-telemetry-upload-api for details.
I had a similar problem and was able to fix it by:
(1) in GUI adding a relation from the DEVICE to an associated ENTITY (in my case it was CUSTOMER entity Type)
N.B. here is a related question with a possible solution for creating the relation in code.
then
(2) updating the root rule chain in thingsboard (also via the GUI). Step by step instructions and a picture of my working rule chain canvas can be found in here.
After taking these steps I was not only able to see latest device telemetry show up on latest telemetry for the related customer in the GUI, but also was able to get back the device id in api response to my request for latest telemetry from all devices belonging to a customer.
In rule chain you can do it easily,
first filter the message to make sure you are selecting the right one, then use " Enrichment node" called (duplicate to related) then use save telemetry like attached.
enter image description here
Push Data from Device to Asset - Basic Example
You can leverage Rule Engine to do that in real time.
First of all you have to establish a relation between a device and an asset which can be done via the Web UI or REST APIs. Below a screenshot for asset Building A that contains the device Thermostat A:
To push Thermostat A data to the related asset Building A, use a Rule Chain where key steps are changing the message originator from device to related asset, and then saving timeseries (or attributes) for the asset. You can decide whether to perform a double saving (first on device and then on asset, as I've done in the rule chain below) or to store data only at asset level. I consider good practice to store raw data as soon as they're uploaded, and to do additional persistence after further computations if needed.
Push data from Device to Asset - Advanced Example
An advanced version of the above example is described here and it shows the calculation of delta temperature between outdoor and indoor thermostats (the devices) installed into a warehouse (the asset).
Professional Edition Rule Nodes
There are some rule nodes suitable for your purposes, such as Duplicate To Related or Aggregate Stream, but they are available only on the Thingsboard PE edition.

Google Places Autocomplete - Clarification on content locale

I have a question regarding the content locale of the Google Places API. In my application, we use Places Autocomplete, and when user chose the specific place, we then use Places Detail API to fetch the information
about the place. Please note, that i've not restricted the places "type" in autocomplete.
Consider this example, "Grant Hyatt Hong Kong" the places autocomplete returns the suggestion. The suggestion has the Place ID as "ChIJ7VpqmF4ABDQRi1SbdlsRfys"
Using the place detail API, https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ7VpqmF4ABDQRi1SbdlsRfys&key=&language=en, the content has information in english and chinese.
--------------------------
"address_components" : [
{
"long_name" : "灣仔",
"short_name" : "灣仔",
"types" : [ "neighborhood", "political" ]
.................
.................
"name" : "Grand Hyatt Hong Kong",
},
--------------------------------
However, when i perform the search using Geocode API,
http://maps.google.com/maps/api/geocode/xml?address=Grand%20Hyatt%20Hong%20Kong,%20hong%20kong, i get the content completely in english. I notice that the Places ID returned in this case, is different from the Places API autocomplete service.
Clearly, the google's database has the information about this place in english. As per the places documentation, the google place API, attempts to return information in the requested locale. In this case, the google's database has the information in english locale.
Why is this difference in the case of Places API?
I can address only one part of your question. Why Geocoding API and Places API search return different results?
Geocoding API doesn't take into account any business, so the result that you get is a different object with place ID ChIJUzElmV4ABDQRyXzjJRwo3VE. This is a compound building that Geocoding API can localize and you can see this building in Map Maker:
https://mapmaker.google.com/mapmaker?gw=90&iwloc=0_0&dtab=history&cid=5898915188285078729
Places API can find a business with place ID ChIJ7VpqmF4ABDQRi1SbdlsRfys. You can see the corresponding feature with the category Hotel in Map Maker:
https://mapmaker.google.com/mapmaker?gw=90&iwloc=0_0&dtab=history&cid=3134242950202741899
Referring to translations, I believe you should raise this issue with Google data team.
Please use the "Report a problem" link on the bottom right corner of the maps.google.com as specified in:
https://support.google.com/maps/answer/162873
Hope it helps!

Soundcloud and api rate limits

What are current api rate limits for track liking? According to documentation the only enforced limits are for stream playing api.
Global Rate Limit
We currently do not enforce any limit on the total number of calls made by a client application in aggregate.
I'm receiving following response when trying to like track via PUT /me/favorites/track endpoint:
{
"errors": [{
"warning_level": "info",
"reason_phrase": "info: too many likes",
"release_at": "2016-08-03T12:20:38+00:00",
"acknowledge_url": "https://api.soundcloud.com/me/warning/favoriting"
}
]
}
Am I wrong or public documentation is inaccurate?
Are you liking the same track? Though there is probably not API rate limits, there is most likely a limit on how many times a user can like a track, to prevent false counts.
Are you liking different tracks? This may be to prevent bots from artificially liking tracks - they want likes to be manual by a user.
Both wouldn't count as rate limits, so I'm not surprised they're not in the API documentation.
This is to prevent fake fan likes aka 'number juicing'. See
http://5chicago.com/features/how-to-become-a-fake-soundcloud-superstar/
https://www.quora.com/How-do-I-stop-insincere-fake-liking-musician-bots-from-invading-my-tracks-on-Soundcloud

Does YouTube Analytics API just give you statistics of your channel?

I am wondering if there is a way that I can get statistics of other channels. I only can see the statistics of my videos. When I use other contentOwners or channels, it says it is forbidden.
Some of the statistics are for yourself like "Total viewcounts (and more) for all self-uploaded content"
But some others like "Top 10 – Most watched videos for a content owner" should work for everyone, right?
Does anyone know the solution that how can I get statistics of different channels?
Thank You
YouTube Analytics API is only for videos on your own channel, or, if you are a content owner, any of your channels or claimed videos. It reflects most of the data that you can see on https://www.youtube.com/analytics Likewise, that data is only available to yourself.
What is available though, is the "statistics" part of the YouTube Video API. Here you can get the data that's available on the watch page. For example:
GET https://www.googleapis.com/youtube/v3/videos?part=statistics&id=9bZkp7q19f0&key={YOUR_API_KEY}
Returns
{
"kind": "youtube#video",
"etag": "\"gMjDJfS6nsym0T-NKCXALC_u_rM/cCAW8VtIzXW5zJKDbjuP9BMWnt4\"",
"id": "9bZkp7q19f0",
"statistics": {
"viewCount": "2072823300",
"likeCount": "8559755",
"dislikeCount": "1090659",
"favoriteCount": "0",
"commentCount": "5247867"
}
}
Here is the reference to the YouTube API with a neat little "Try it" section in the bottom to play around with:
https://developers.google.com/youtube/v3/docs/videos/list#try-it