Uber Details On sandbox - uber-api

I am using uber-api`s in India for my project,as my project is still in the development phase,i am using the sandbox environment.While using this testing environment uber is just returning the following details on the sandbox environment
1.Allows to book a ride.
2.List of the products of the uber(Uberx,UberGo)
3.Dummy receipt.
The information that is missing on the sandbox environment is
1.The Driver Details
2.Vehicle Details
3.Surge Pricing.
Is there any way through which i can get all these details on my sandbox environment?or is it a bug?
Thanks in Advance.

The Sandbox mode passes through calls to all available endpoints. It essentially makes exceptions for /requests/{request_id} and /products/{product_id} (by allowing you to use HTTP PUT):
At this time, most of the endpoints in the Sandbox environment are proxied straight to the production environment. The Request endpoint is the primary exception. It allows you to exercise the flow of ordering an Uber in your application without worrying about a real world trip being created. Additionally, you can simulate surging products or no drivers being available to ensure that your application handles these scenarios properly.
I have to admit that I'm not familiar with India-specific differences for the Uber API (would love to know them), but in general, the Uber API allows you to do this:
1) GET /requests/current and GET /requests/{request_id}: Returns (amongst other elements) the driver & vehicle details as JSON objects:
{
...
"driver": {
"phone_number": "(555)555-5555",
"rating": 5,
"picture_url": "https:\/\/d1w2poirtb3as9.cloudfront.net\/img.jpeg",
"name": "Bob"
},
"vehicle":{
"make": "Bugatti",
"model": "Veyron",
"license_plate": "I<3Uber",
"picture_url": "https:\/\/d1w2poirtb3as9.cloudfront.net\/car.jpeg"
},
...
}
2) POST /requests: When booking a ride, the server can return a HTTP 409 status code - in case surge pricing is in effect. It provides the following details in a JSON object:
"meta": {
"surge_confirmation": {
"href": "https:\/\/api.uber.com\/v1\/surge-confirmations\/e100a670",
"surge_confirmation_id": "e100a670",
"multiplier": 1.4,
"expires_at": 1459191276
}
}
To complete, you would need to redirect the user to the confirmation URL (meta.surge_confirmation.href)

Related

Is it possible to set out user status message in teams through graph API?

I want to set user status message in teams using graph api and I saw this code but it's not working for me is there any solution that could help??
"#odata. context":"https://graph.mic.."
"id": "f599db41-7474-416a-acb1-88f9e
"availability": "Available"
"activity" :"Available"
"outofOfficeSettings": {"message": "oof mes"
"is0utofoffice":true }
Note: the availability & activity is working and has been updating in teams but the part below is not working for me""
or is there any way using graph api that I could set teams status message from bambooHR direct to teams?
You cannot set out of office user presence through graph API. As of now, only the parameters mentioned below are supported in the body of setPresence call
POST https://graph.microsoft.com/beta/users/object_id_of_user/presence/setPresence
Also, this call is supported under Application context only and not under user context.
sessionId
availability
activity
expirationDuration
However, you can view the out of office user presence via graph API by using below call:
GET https://graph.microsoft.com/beta/me/presence
or
GET https://graph.microsoft.com/beta/users/object_id_of_user/presence
{
"id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"availability": "Available",
"activity": "Available",
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
}
}
Ref Doc:
https://learn.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-beta&tabs=http
https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-beta&tabs=http
If you wish you may vote for this feature on Microsoft Teams ยท Community

Facebook API Lead retrieval for internal business app should i submit for App Review

I am building a dedicated CRM solution and it is supposed to show the list of Facebook leads of the client and then convert manually it to internal lead . I am managed to setup a websocket client and Facebook is sending me lead details including leadgen_id.
{
"object":
"page" ,
"entry": [{
"id": "*****" ,
"time": 1627211279 ,
"changes": [{
"value": {
"form_id": "******" ,
"leadgen_id": "******" ,
"created_time": 1627211277 ,
"page_id": "******"} ,
"field": "leadgen"}
]}
]}
Then i have created an user access_token using Facebook's graph api and requested for the details of the leadgen_id using api endpoint
https://graph.facebook.com/v11.0/<LEADGEN_ID>?access_token=<ACCESS_TOKEN>
I was able to get the details of the test lead I created with the Facebook 's lead testing tool. But when accessing the production leadgen_id I am getting an exception with following as response.
{
"error": {
"message": "Unsupported get request. Object with ID '<LEADGEN_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "*********"
}
}
Then I have tried using a system user token and its not even working for the test leads. In some part of documentation it is saying that I need to complete App review to access live data using lead_retrieval and in some other part of documentation its quoted that I don't need app review to use API for internal users . And I don't get the point of creating a 'login with Facebook' for this internal app specific for one user .
Is there anyway other way than completing app review to access lead details using leadgen_id ?
Its turns out I need to complete the app review specifying it as a 'Server to server app' on the review description, which doesn't need any Login with facebook button . Got the idea from https://developers.facebook.com/docs/app-review/resources/sample-submissions/server-to-server/

Implementing tripadvisor traveller rating

my goal is to show TripAdvisor score rank inside my app alongside other ranking system. Keep in mind that my application is a B2B app, not B2C.
What i can not understand even after reading the developer documentation is what kind of API should i eventually ask for.
The Content API is only for B2C purposes...but, apparently, it is the only one that send me in response the actual TripAdvisor rating (the only thing i actually want from all TripAdvisor information).
Has anyone implemented TripAdvisor in an OTA (online travel agency) application and can guide me on which APIs to request?
Thank you in advice
I have not implemented TripAdvisor ratings in a B2B system, but helped on a B2C project that used Tripadvisor data.
Your findings regarding Content API is correct, this is the only API where you find ratings.
Rating is TripAdvisor "selling point", so this data protected and can only be used by following their presentation terms. Check out how here: https://developer-tripadvisor.com/content-api/display-requirements/
You have 6 months implementation time and have to get Tripadvisor approval, or they cancel your API key. By using their API you commit not to store any data retrieved from their API.
Quick guide to use their API: https://developer-tripadvisor.com/content-api/documentation/
Call the locator_mapper to get possible location_id(s)
http://api.tripadvisor.com/api/partner/2.0/location_mapper/42.344978,-71.119030?key=[YOUR_KEY_HERE]-mapper&category=hotels&q=Beacon%20Townhouse%20Inn%201023
It returns a JSON with possible locations,
{
"data": [
{
"location_id": "89575",
Then call location with the id to get ratings: http://api.tripadvisor.com/api/partner/2.0/location/89575?key=[YOUR_KEY_HERE]
"review_rating_count": {
"1": "18",
"2": "22",
"3": "63",
"4": "269",
"5": "1408"
},
Use this data, together with the presentation and links back to tripadvisor to comply with their license.

Using generated page access_token in multiple regions

I am trying to subscribe my facebook chatbot to the user's page, using the manage_pages permission.
I already have the permission approved to my app, but I am having trouble, because the token is generated in the browser(in Brazil), but I send it to aws lambda in US west 2, and I get the following error
The \'manage_pages\' permission must be granted before impersonating a user\'s page.
In my test, I run the subscribe process in my machine, and reuse this token in AWS Lambda(US West 2). After researching and making some tests, I figured out that it just dont work in USA, in Brazil it works.
Using the same token generated in the process, I run the following test.
var request = require("request")
request.post("https://graph.facebook.com/v2.9/me/messages", {
qs: {
access_token: "GENERATED TOKEN"
},
json: {
"recipient": {
"id": "USER_ID"
},
"message": {
"text": "hello!"
}
}
},function(e){
if(e){
return console.log("ERROR",e)
}
console.log("FINISH",arguments)
})
When I run with my internet, it works fine, but If I use a VPN in Miami, the error occurs.
I believe it has something to do with the data replication that facebook does, but how can I make this token be accessible by the USA region?
EDIT
I found this error when starting the facebook login process with the VPN online:
I didnt find any restrictions in my app, where can I check this?
The problem was occurring because my app had coutry restriction to only Brazil, I added United States to restrictions and it worked.
The restriction can be changed in Settings -> Advanced, App Restrictions

Validate Facebook work position targeting IDs

Our Facebook Ad system uses work position in its targeting spec as documented here: https://developers.facebook.com/docs/marketing-api/targeting-specs/v2.3#education_and_workplace
Sometimes Facebook deletes existing work positions and API requests to update the targeting spec fails:
{
"error":
{
"message": "Invalid parameter",
"type": "FacebookApiException",
"code": 100,
"error_subcode": 1487079,
"is_transient": false,
"error_user_title": "Invalid Targeting Spec",
"error_user_msg": "The specified targeting spec is not valid because: Job Titles with id 1542119359378854 is invalid."
}
}
The same happens with interest, but there is an API request to validate interests: https://developers.facebook.com/docs/marketing-api/targeting-search/v2.3#interest_validation
Is there something similar for work positions? (Probably undocumented?)
I could do requests to the /search/ API endpoint, but then I'd run into API request limits.
Unfortunately you are out of luck; there is no validation feature for work positions.
However, the example on the Facebook docs page you mentioned ([{'id':105763692790962, 'name':'Business Analyst'}]) seems to contain a working Facebook ID. Fetching e.g. https://graph.facebook.com/v2.2/105763692790962 will return the following output, so long as this profession exists:
{
"category": "Profession",
"name": "Business Analyst",
"id": "105763692790962"
}
This is of course not entirely what you are looking for, but if you want to limit the number of requests you make, you could implement your advertising app in such a way that it only tries to resolve professions by their ID once you run into trouble with your targeting spec. Getting back data for such a sanity check-request indicates that a work position is still valid. Should it not be valid any more, you can resort to using the /search endpoint to find a replacement.
You could also suggest that Facebook add this feature: https://www.facebook.com/help/suggestions