UberRUSH delivery state after client Cancel call - uber-api

I have a question regarding UberRUSH API.
I read https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-cancel-post and it's not clear for me what is the state of delivery right after successful POST /v1/deliveries/{delivery_id}/cancel.
I will get just 204 status code in response then, and I don't know if status of delivery will be set to client_canceled during that call, or I will be changed asynchronously and I should wait for status update from Uber?

The statuses guide in the developer documentation provides the answer:
client_canceled: This delivery was canceled by the API client. If you want to update the status of a trip to client_canceled, please refer to the POST /deliveries/{delivery_id}/cancel endpoint.

Related

Do we have an API for getting invoice details of completed rides in uber?

Any API for getting invoice for completed rides in uber? I have checked the uber API docs couldn't find any.
For rider history, you could call the /history endpoint (https://developer.uber.com/docs/riders/references/api/v1.2/history-get) but this does not include fare details.
If your app is the origin of the trips, you can call /receipt endpoint for each trip via https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-receipt-get
If you are looking to get all trips including fare details and they are not coming from your app ID, unfortunately that is not available. "The receipt endpoint will only provide receipts for ride requests originating from your application. It is not currently possibly to receive receipt data for all trips."
For a non-api solution you can look at past trips including fare details in your app or on the web at https://riders.uber.com/trips. Hope this helps!

ReST API response codes

I am trying to design a few ReST APIs.
One functionality is where for a request from the client to create a resource, the service should do 2 things
Create a resource on one system (s1)
Sync this data with another system (s2).
The client will then access s2 to read the data. A possible scenario is where the resource gets created on s1 but the sync to s2 fails.
Now, from the service's perspective the request was partially successful so a response code 207 with multistatus body may be okay to use but from client's perspective the resource is not yet available so this is a failure (status - 5xx).
Now which perspective should be considered while designing APIs?
The way I finally implemented this is by making my processing asynchronous. As soon as the client sends the request, service persists the request, generates a new transaction id for this request and sends back a 202 response with a location header containing the url to query about the transaction status. It then attempts to process the request (create resource on s1 and sync it to s2) asynchronously. The client meanwhile can keep checking on the transaction status which will keep sending a "In progress" state. As soon as the request is processed, the transaction status is update to "success". On next query from the client, the success status is returned and then the client can move ahead.

How to get updated end location for a Uber Ride?

I am using Uber's webhooks to trigger retrieving ride information using uber API. Although if the ride's destination changes when the ride is in progress, I don't get a hook callback. And once the ride is completed, the start and destination information is not available in ride details.
Is there a way to get this information (rather than keep polling the API every few seconds?)
You should receive the location information in the 'in_progress' webhook. We do not currently fire event if destination changes so the only way to discover is to poll the /requests/current end point. Uber API will not return the final location after the trip has been completed or via the history endpoint (though you can see the pickup location).

Uber Deep link with promocode webhook

Case:
I bought Uber Event with promocodes.
Made a deep link from my app to Uber:
https://m.uber.com/ul/?client_id=xxxyyy-zzz&action=applyPromo&promo=existingtestpromo
Set up an API webhook in the Uber Dashboard to receive POST at https://45.55.254.130/uber/webhook/ (no domain yet and self-signed SSL)
User followed the link and made a ride. He finished the ride ok.
No webhook received at all(django+uwsgi logs empty on that url). I also tested that url manually sending POST request from code - it works.
Are the webhooks used at all when using deep links with promocodes?
Webhooks do not get sent when you use the deeplinks (promo code or set pickup). You can receive webhooks when you make a ride request using POST v1/requests or when you have the all_trips scope.
Here's information about making a ride request using the API: https://developer.uber.com/docs/rides/sdks/introduction
And here's information about all_trips scope (the feature is called Trip Experiences): https://developer.uber.com/docs/rides/tutorial-trip-experiences-getting-started

Calling CreditsCallback.php when order reached status refunded by calling graph API

I would like to ask: does FB call creditsCallback.php with status refunded, when we update order status to refunded through FB graph API? Because we want to handle this status also, but our creditsCallback.php is not called, when order reached this status. Thanks a lot.
I was wondering the same thing as I implement our refunding system.
I have made some tests and I can confirm to you that Facebook DOES NOT call you back notifying the refunded status.
So, when you make the POST call to the graph API saying that you want to refund the order, you should verify that the response from facebook is simply "true" and then update your database.