Uber API /v1/estimates/price responds No authentication provided - uber-api

In my programe, I need to use the Uber api:
/v1/estimates/price
,so I test it in chrome by postman, but it responses No authentication provided.
I search the stackoverflow and find this page "Uber API /v1/estimates/time responds No authentication provided".
According to the last answer from faarwa which guide the asker get the complete info, I think I would get the complete info like the asker, but in fact,I failed,I got the same response.
This is my url:
https://api.uber.com.cn/v1/estimates/price?server_token=MyTooken&start_latitude=31.993750705445024&start_longitude=118.71421140272062&end_latitude=32.046405144489704&end_longitude=118.80070636431914
the response is:
{
"message": "No authentication provided.",
"code": "unauthorized" }
BTW: I tested the api in China.

I checked your curl command and it looks great. In fact, I get a response for the exact command with my server_token:
curl "https://api.uber.com.cn/v1/estimates/price?server_token=<SERVER_TOKEN>&start_latitude=31.993750705445024&start_longitude=118.71421140272062&end_latitude=32.046405144489704&end_longitude=118.80070636431914" | jq
My response is:
{
"prices": [
{
"localized_display_name": "People's Uber +",
"distance": 7.72,
"display_name": "People's Uber +",
"product_id": "...",
"high_estimate": 34,
"surge_multiplier": 1,
"minimum": 7,
"low_estimate": 24,
"duration": 2160,
"estimate": "CN¥24-34",
"currency_code": "CNY"
},
{
"localized_display_name": "Uber Sedan",
"distance": 7.72,
"display_name": "Uber Sedan",
"product_id": "...",
"high_estimate": 111,
"surge_multiplier": 1,
"minimum": 20,
"low_estimate": 86,
"duration": 2160,
"estimate": "CN¥86-111",
"currency_code": "CNY"
}
]
}
Here's my assumption why your query doesn't work: You are trying to use Uber in China (based on the URL and location), which requires you to use an Uber app for China as well. Could you please validate if your app shows up in the Uber Dashboard China? For more information, please check out the China Guide in our developer docs.

Just to be clear - the reason it is not working is the app you created was not created in the Uber China Developer Dashboard. If you use credentials from a newly created app it should work as expected.

Related

WhatsApp Business API - Edit Template

I'm trying to send a POST request to edit a template message of WhatsApp:
POST /{whatsapp_template_id}
{
"name": "my_template",
"language": "en_US",
"category": "transactional",
"components": [
{
"type": "BODY",
"text": "whatsapp buddy?"
}
]
}
Receiving (#3) Application does not have the capability to make this API call.
Currently, there is no edit template API, as per the documentation it will Available from September 7, 2022.

Why do I get two UberPool products in the APIs?

I get two UberPool products in the following APIs:
api.uber.com/v1/estimates/time
api.uber.com/v1/estimates/price
api.uber.com/v1/products
Why do I get two products? How are they different?
Example response:
Url:
api.uber.com/v1/estimates/price
Response:
{
"prices": [
{
"localized_display_name": "uberPOOL",
"high_estimate": 33,
"minimum": null,
"duration": 0,
"estimate": "₹32.50",
"distance": 0,
"display_name": "uberPOOL",
"product_id": "e0178e76-b13f-4ae6-9f72-6acadbb450c5",
"low_estimate": 32,
"surge_multiplier": 1,
"currency_code": "INR"
},
{
"localized_display_name": "uberPOOL",
"high_estimate": 51,
"minimum": null,
"duration": 0,
"estimate": "Unavailable",
"distance": 0,
"display_name": "uberPOOL",
"product_id": "f855a84b-a0ec-40d8-a455-fb0d2db58089",
"low_estimate": 50,
"surge_multiplier": 1,
"currency_code": "INR"
},
{
"localized_display_name": "uberGO",
"high_estimate": 50,
"minimum": 50,
"duration": 0,
"estimate": "₹50",
"distance": 0,
"display_name": "uberGO",
"product_id": "18ba4578-b11b-49a6-a992-a132f540b027",
"low_estimate": 50,
"surge_multiplier": 1,
"currency_code": "INR"
}
....
]
}
Thank you for the report. This is a known issue and we're working on a fix. In the meantime, you can use either uberPOOL product that is surfaced.
TL;DR Uber sometimes offers many products in a given location, and they're all returned from those two endpoints.
To expound on that... according to the docs, this is normal:
The Products endpoint returns information about the Uber products
offered at a given location. The response includes the display name
and other details about each product, and lists the products in the
proper display order.
Some products, such as uberEATS, are not returned by this endpoint.
We'll soon be making uberPOOL available in this endpoint.
Particularly: We'll soon be making uberPOOL available in this endpoint. It seems that time has come.
The same goes for the estimates endpoint.
The Price Estimates endpoint returns an estimated price range for each
product offered at a given location.
How are they different?
Uber offers different types of services in different countries.
UberGo is a cheaper version of UberX that seems to be specific to India.
UberPool is fairly straight forward in that it's a carpooling service offered to those who wish to split the fare with others that are heading in the same destination.
Since services vary by location, it's best to research them individually when constructing a service that's consuming the Uber API.

Facebook Ads API: transaction_detail?

Facebook currently supports the ability to list the transactions that occur on an Ad Account through their API (although its very hard to find):
https://graph.facebook.com/v2.4/act_{{ACCOUNT_ID}}/transactions
{
"id": "{{TRANSACTION_ID}}-1399450",
"time": 1438255264,
"account_id": "{{ACCOUNT_ID}}",
"fatura_id": 0,
"amount": {
"currency": "CAD",
"total_amount": "2,100.40"
},
"charge_type": "payment",
"status": "completed",
"billing_start_time": 0,
"billing_end_time": 0,
"payment_option": "credit_card",
"tx_type": 3,
"app_amount": {
"currency": "CAD",
"amount": "2,100.40"
},
"provider_amount": {
"currency": "CAD",
"amount": "2,100.40"
}
}
However, if you notice, there's nothing in there about the Payment ID, thus making it very difficult to figure out what the heck this transaction/payment is for... nothing tiing to ads, adsets, campaigns, anything!
If anyone has any recommendations as to how to get more specific information about a transaction, I would love the help!
Also - just to note that if I used my APP_ID token (because it claims I can't do it from a user access token, which misleads me to think I was actually getting somewhere!) and ping the transaction id as such:
https://graph.facebook.com/v2.4/{{TRANSACTION_ID}}
I get:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
Which is how you can apparently inspect payments from within canvas payments, but this is specifically for Ad accounts payments/transactions.

Facebook Insights API is returning no data (empty array) for a post

My application is pulling back a few insights statistics. This works fine for my FB account, which I used to develop the feature, but my users get an empty array, ex:
{
"data": [],
"paging": {...}
}
I obtain authorization via OAuth and I've asked for the read_insights permission. I can verify it has been granted in the list of permissions
https://graph.facebook.com/me/permissions?access_token=XXX
{
"data": [
{
"installed": 1,
"basic_info": 1,
"public_profile": 1,
"read_stream": 1,
"status_update": 1,
"photo_upload": 1,
"video_upload": 1,
"create_note": 1,
"share_item": 1,
"export_stream": 1,
"publish_stream": 1,
"read_insights": 1,
"manage_pages": 1,
"publish_actions": 1,
"user_friends": 1
}
],
"paging": {...}
}
I know the post is valid since I can request it with the graph api
https://graph.facebook.com/[post id]?access_token=XXX
Also, the account meets the > 30 followers requirement for Insights
Update
I can get insights for all posts except those generated by my application. The only difference between posts generated by my app and facebook are:
Facebook has
"privacy": {
"description": "Public",
"value": "EVERYONE",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"status_type": "shared_story",
Mine has
"privacy": {
"value": ""
},
"status_type": "app_created_story",
"application": {
"name": "Company",
"id": "1111111111111"
},
However I was able to get insights on a Facebook generated status that has privacy:
privacy: {
value: ""
},
So only difference now is "application" and "status_type".
I was using the facebook js sdk to post. If I use server api post I can get insights so looks to me like a Facebook bug
We had a similar problem, we were able to solve it, it's mostly a mismatch of accesses:
just follow the following steps:
Add the user (developer) profile to the company facebook page as an advertiser.
Also, add the same account on the Facebook Bussiness manager as an advertiser.
And then you will receive an email from facebook to confirm the granted accesses. Confirm them , all done.
Now you have all the needed access at the right place.
Lastly, you can test again https://graph.facebook.com/v2.7/XXXXXXXXXXXXXXX/insights/ where XXXXXXXXXXX is the Company Ads' Id

How do I read mentions in fb api?

When I get a certain status in "/{status id}" api call, I get the message stripped from the mentions. How can I read the mentions?
Thanks
the field message_tags will give an array of mentioned users/pages in that post
Example:
"message_tags": {
"13": [
{
"id": "92689703737",
"name": "Tumblr",
"type": "page",
"offset": 13,
"length": 6
}
]
}