object change notifications are delivered many minutes later than the file is uploaded - google-cloud-storage

When uploading files to google cloud storage using resumable upload and getting 2xx code after the final chunk had been uploaded sometimes it takes a few seconds to get a notification and sometimes they are delayed for as much as 40! minutes. This is extremely unpredictable and leads to poor user experience.
Could some1 help me and explain what I could be doing wrong?
Example of response to hook (I do accept them properly with 2xx status codes)
{
"name": "core-api",
"hostname": "http-in-production-0",
"pid": 1,
"namespace": "audit",
"audit": true,
"level": 30,
"remoteAddress": "10.240.0.6",
"remotePort": 36689,
"req_id": "6feb5f2a-82aa-4d24-b844-2db915868fd3",
"req": {
"query": {},
"method": "POST",
"url": "/api/files/gce",
"headers": {
"host": "redacted.com",
"accept-encoding": "gzip",
"cf-ipcountry": "US",
"x-forwarded-for": "66.102.6.238",
"cf-ray": "2bba889f9fcb5011-DEN",
"content-length": "1306",
"cf-visitor": "{\"scheme\":\"https\"}",
"accept": "*/*",
"x-goog-channel-id": "cdn-channel-id-redacted",
"x-goog-resource-state": "exists",
"x-goog-message-number": "9748944617",
"x-goog-resource-id": "-----resource-id------",
"x-goog-resource-uri": "https://www.googleapis.com/storage/v1/b/cdn.redacted.com/o?alt=json",
"x-goog-channel-token": "secret-token-redacted",
"content-type": "application/json; charset=UTF-8",
"user-agent": "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)",
"cf-connecting-ip": "66.102.6.238",
"x-forwarded-proto": "https",
"connection": "close"
},
"httpVersion": "1.1",
"trailers": {},
"version": "*",
"timers": {
"remapXFFheader": 32,
"restifyCORSSimple": 16,
"parseAccept": 120,
"parseQueryString": 22,
"gzip": 887,
"checkIfMatch": 27,
"checkIfNoneMatch": 22,
"checkIfModified": 45,
"checkIfUnmodified": 18,
"remapContentType": 10,
"readBody": 343,
"parseBody": 57,
"restifyLogger": 205,
"attachAMQP": 19,
"initContext": 12,
"activateAccount": 542,
"handeReact": 411,
"responseContentType": 27,
"gceWebhook": 304,
"completeResumableUpload": 55245
}
},
"res": {
"statusCode": 202,
"headers": {
"content-encoding": "gzip",
"content-type": "application/vnd.api+json"
},
"trailer": false
},
"err": null,
"latency": 63,
"_audit": true,
"msg": "handled: 202",
"time": "2016-07-01T14:26:33.645Z",
"v": 0
}

Please see the Reliable Delivery section of the documentation. In particular, I'll quote here:
Object Change Notification will attempt to deliver notifications to
your application in a reliable way. However, be aware that
notifications can be delayed indefinitely, and timeliness is not
guaranteed.

Related

Getting invalid_payment response from uber with 400 status code;using rest API

I am using REST API to book and uber ride using: https://api.uber.com/v1.2/requests .
It's not working with payment methods other than Cash.
I am getting 400 with code:invalid_payment
Can someone please help me out;
I am able to make payment using cash & Paytm for Indian locations.
I am not able to make payment using cash for US locations.
I am not able to make payment using the card for Indian & US locations.
When I add a new card via the Uber app and try to book a cab in the uber using the card it works; When I try to use the same card using my app it shows error. After this when I try to book a cab using the uber app; it doesn't work.
This the the response I am getting from Uber:
{
"data": {
"meta": {},
"errors": [
{
"status": 400,
"code": "invalid_payment",
"title": "The rider's payment method is invalid and they must update their billing info."
}
]
},
"status": 400,
"headers": {
"server": "nginx",
"strict-transport-security": "max-age=604800",
"x-frame-options": "SAMEORIGIN",
"content-type": "application/json",
"content-geo-system": "wgs-84",
"date": "Fri, 05 Apr 2019 06:28:50 GMT",
"x-content-type-options": "nosniff",
"content-length": "151",
"cache-control": "max-age=0",
"connection": "keep-alive",
"x-xss-protection": "1; mode=block"
},
"config": {
"transformRequest": {},
"transformResponse": {},
"timeout": 180000,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"headers": {
"Accept": "application/json, text/plain, /*",
"Content-Type": "application/json",
"authorization": "Bearer JA.ZWU",
"Accept-Language": "en_US"
},
"method": "post",
"url": "https://api.uber.com/v1.2/requests",
"data": "{\"start_latitude\":40.8037381,\"start_longitude\":-73.9577813,\"end_latitude\":40.68780810000001,\"end_longitude\":-73.8057292,\"fare_id\":\"7636a3afa24d7648656aabbcc695bf094d4eed6d9323f3b10a5a5868a47c\",\"product_id\":\"b64-5de2-4539-a35a-986d6e58f186\",\"payment_method_id\":\"0xxxx-90ce-4c1d-a8c4-af7b1a00c3cf\"}"
},
"request": {
"UNSENT": 0,
"OPENED": 1,
"HEADERS_RECEIVED": 2,
"LOADING": 3,
"DONE": 4,
"readyState": 4,
"status": 400,
"timeout": 180000,
"withCredentials": true,
"upload": {},
"_aborted": false,
"_hasError": false,
"_method": "POST",
"_response": "{\"meta\":{},\"errors\":[{\"status\":400,\"code\":\"invalid_payment\",\"title\":\"The rider's payment method is invalid and they must update their billing info.\"}]}",
"_url": "https://api.uber.com/v1.2/requests",
"_timedOut": false,
"_trackingName": "unknown",
"_incrementalEvents": false,
"responseHeaders": {
"Server": "nginx",
"Strict-Transport-Security": "max-age=604800",
"X-Frame-Options": "SAMEORIGIN",
"Content-Type": "application/json",
"Content-Geo-System": "wgs-84",
"Date": "Fri, 05 Apr 2019 06:28:50 GMT",
"X-Content-Type-Options": "nosniff",
"Content-Length": "151",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
"X-XSS-Protection": "1; mode=block"
},
"_requestId": null,
"_headers": {
"accept": "application/json, text/plain, /*",
"content-type": "application/json",
"authorization": "Bearer JA.VUNU",
"accept-language": "en_US"
},
"_responseType": "",
"_sent": true,
"_lowerCaseResponseHeaders": {
"server": "nginx",
"strict-transport-security": "max-age=604800",
"x-frame-options": "SAMEORIGIN",
"content-type": "application/json",
"content-geo-system": "wgs-84",
"date": "Fri, 05 Apr 2019 06:28:50 GMT",
"x-content-type-options": "nosniff",
"content-length": "151",
"cache-control": "max-age=0",
"connection": "keep-alive",
"x-xss-protection": "1; mode=block"
},
"_subscriptions": [],
"responseURL": "https://api.uber.com/v1.2/requests"
}
}
Actual result should be ride request accepted.

Wunderlist API: Patch request of completed task works on http request , but not update on app

I try to use the patch request to complete my task and I get a response for task completion, but it doesn't update on the wunderlist app. I did about 9 revision. I get a response that shows completion, but when I return to the app it shows no update. Here my response from the request:
{
"id": 3898040341,
"created_at": "2018-06-01T10:20:00.703Z",
"created_by_id": 24870738,
"created_by_request_id": "worker:w:w:recurring_task_creator:parent-3858561041",
"recurrence_type": "day",
"recurrence_count": 1,
"due_date": "2018-06-02",
"completed": true,
"completed_at": "2018-06-18T12:30:20.547Z",
"completed_by_id": 24870738,
"starred": false,
"list_id": 350926181,
"revision": 9,
"title": "Turn on computer",
"type": "task"
}
It says I completed it today, but the apps didn't update on either my phone, tablet, or completed.
Please help. Thanks.
Nevermind, I figure it out. The id of the task changes everytime it is completed. This is for a recurring task. So I need to update the current request with a new ID.
Old request result with ID 3952832467
{
"id": 3952832467,
"created_at": "2018-06-19T11:42:13.366Z",
"created_by_id": 24870738,
"created_by_request_id": "worker:w:w:recurring_task_creator:parent-3949658004",
"recurrence_type": "day",
"recurrence_count": 1,
"due_date": "2018-06-05",
"completed": true,
"completed_at": "2018-06-19T11:42:55.835Z",
"completed_by_id": 24870738,
"starred": false,
"list_id": 350926181,
"revision": 2,
"title": "Turn on computer",
"type": "task"
}
Same request result, but with no ID 3952834287:
{
"id": 3952834287,
"created_at": "2018-06-19T11:42:56.132Z",
"created_by_id": 24870738,
"created_by_request_id": "worker:w:w:recurring_task_creator:parent-3952832467",
"recurrence_type": "day",
"recurrence_count": 1,
"due_date": "2018-06-06",
"completed": true,
"completed_at": "2018-06-19T14:52:28.644Z",
"completed_by_id": 24870738,
"starred": false,
"list_id": 350926181,
"revision": 2,
"title": "Turn on computer",
"type": "task"
}

Uber API GET/estimates/price response surge_multiplier disappeared

today, I found GET/estimates/price end point have a change, surge_multiplier disappeared, is to say, price has been fixed, no more surge?
Surging is based on the particular location and product setup - so if you try following request for example:
https://sandbox-api.uber.com//v1.2/estimates/price?start_latitude=-33.865535736083984&start_longitude=151.1958770751953&end_latitude=-33.88345718383789&end_longitude=151.0906982421875
"prices": [
{
"localized_display_name": "uberX",
"distance": 7.76,
"display_name": "uberX",
"product_id": "2d1d002b-d4d0-4411-98e1-673b244878b2",
"high_estimate": 35,
"surge_multiplier": 1,
"minimum": 9,
"low_estimate": 26,
"duration": 1260,
"estimate": "A$26-35",
"currency_code": "AUD"
},
If you try it for different location:
start_latitude=37.7752315&start_longitude=-122.418075&end_latitude=37.7752415&end_longitude=-122.518075
You will get response without 'surge_multiplier' parameter:
{
"localized_display_name": "uberXL",
"distance": 6.62,
"display_name": "uberXL",
"product_id": "821415d8-3bd5-4e27-9604-194e4359a449",
"high_estimate": 28,
"low_estimate": 22,
"duration": 1380,
"estimate": "$22-28",
"currency_code": "USD"
},
For more info on surging please read our documetation
EDIT done on 02/15/2018:
If you are using v1.2 request - response we are getting is based on the product setup. If the product used in the estimate request is configured to have "upfront_fare_enabled": true then we will get one fare_id - instead of estimate. So this is expected as in v1.2 with upfront_fare_enabled: true there will never be surge information (as you get a real fare + fare_id).
Please check following sentence from our documentation on "POST /v1.2/requests/estimate" endpoint:
You should use this endpoint to get an upfront fare before requesting
a ride. In some products upfront fares are not enabled so you can use
this endpoint to determine if surge pricing is in effect for the
product/location. Do this before attempting to make a ride request so
that you can preemptively have a user confirm surge by sending them to
the surge_confirmation_href provided in the response. This endpoint
will either return an upfront fare (in the fare key) or a range
estimate (in the estimate key) depending on the configuration of the
product.
So the response you are getting back depends on product configuration specifically: "upfront_fare_enabled" field. If there is upfront fare setup (upfront_fare_enabled = true) then there will not be "surge_confirmation_href" available in the response - and response type will be one "fare": {} response - example of this is below:
{
"fare": {
"value": 5.73,
"fare_id": "d30e732b8bba22c9cdc10513ee86380087cb4a6f89e37ad21ba2a39f3a1ba960",
"expires_at": 1476953293,
"display": "$5.73",
"currency_code": "USD",
"breakdown": [
{
"type": "promotion",
"value": -2.00,
"name": "Promotion"
},
{
"type": "base_fare",
"notice": "Fares are slightly higher due to increased demand",
"value": 7.73,
"name": "Base Fare"
}
]
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 540,
"distance_estimate": 2.39
},
"pickup_estimate": 2
}
As you can see there is no "surge_confirmation_href" available.
If your product has "upfront_fare_enabled": false you will get estimate response with surge_confirmation_id and surge_confirmation_href as shown below:
{
"estimate": {
"surge_confirmation_href": "https:\/\/api.uber.com\/v1\/surge-confirmations\/7d604f5e",
"high_estimate": 11,
"surge_confirmation_id": "7d604f5e",
"minimum": 5,
"low_estimate": 8,
"fare_breakdown": [
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Base Fare"
},
{
"low_amount": 1.92,
"high_amount": 2.57,
"display_amount": "1.92-2.57",
"display_name": "Distance"
},
{
"low_amount": 2.50,
"high_amount": 3.50,
"display_amount": "2.50-3.50",
"display_name": "Surge x1.5"
},
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Booking Fee"
},
{
"low_amount": 1.36,
"high_amount": 1.81,
"display_amount": "1.36-1.81",
"display_name": "Time"
}
],
"surge_multiplier": 1.5,
"display": "$8-11",
"currency_code": "USD"
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 480,
"distance_estimate": 1.95
},
"pickup_estimate": 2
}
And finally, if you update the product to have "surge_multiplier" > 1 and product have "upfront_fare_enabled = true" you will get "fare" response - but you will not know that surging is in place - until you do ride request. In this case, you will get the response with: "status": 409 and "title": "Surge pricing is currently in effect for this product." and "surge_confirmation" info that contains "href": "https://sandbox-api.uber.com/surge-confirmations/ride_request_id". So in order to complete your ride request - you need to redirect your user to that URL - and user needs to confirm surging. After that, you will be able to create new ride request.
resposne->
{
"meta": {
"surge_confirmation": {
"href": "https://sandbox-api.uber.com/surge-confirmations/48165d0e-f2f4-457d-98d0-058a31b15cd7",
"expires_at": 1510684778,
"multiplier": 1.2,
"surge_confirmation_id": "48165d0e-f2f4-457d-98d0-058a31b15cd7"
}
},
"errors": [
{
"status": 409,
"code": "surge",
"title": "Surge pricing is currently in effect for this product."
}
]
}

Unauthorized payment error in paypal while using LIVE credentials

I am using Paypal REST API for payments.All was working fine with sandbox credentials but when I switched to LIVE credentials.It is giving errors like this :
Request to paypal API :
{
"body": {
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card_token": {
"credit_card_id": "CARD-7314506536077511MK7WL121",
"payer_id": "57ecbbed656c78519a28382c"
}
}
]
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": 10
},
"description": "Payment taken from customer Neha for booking #SR1032 and to be send to SP Neha and SP paypal Id hello#y.bom"
}
]
},
"header": {
"x-pp-ads-performed": "false",
"content-length": "374",
"pp_remote_addr": "54.244.2.156",
"paypal-request-id": "2afb7a93-0cc2-4ab2-b216-45b8de908f9f",
"pp_geo_loc": "US",
"x-pp-silover": "name=LIVE3.API.1&silo_version=880&app=platformapiserv&TIME=2734681175&HTTP_X_PP_AZ_LOCATOR=",
"host": "api.paypal.com",
"accept": "application/json",
"client-auth": "No cert",
"connection": "close",
"x-pp-idempotencyid": "eabb84d3ef438_1475149730",
"x-slr-orig-script_uri": "https://api.paypal.com/v1/payments/payment/",
"x-pp-slingshot-targetapp": "platformapiserv",
"x-pp-corrid": "eabb84d3ef438",
"user-agent": "PayPalSDK/PayPal-node-SDK 1.6.9 (node v4.5.0-x64-linux; OpenSSL 1.0.2h)",
"content-type": "application/json",
"authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9T1G"
},
"additional_properties":
Response from paypal server
{
"status": 401,
"duration_time": 49,
"body": {
"message": "Unauthorized payment.",
"debug_id": "eabb84d3ef438",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNAUTHORIZED_PAYMENT",
"name": "UNAUTHORIZED_PAYMENT"
},
"additional_properties": {},
"header": {
"Content-Length": "191",
"Content-Language": "*",
"CORRELATION-ID": "eabb84d3ef438",
"Date": "Thu, 29 Sep 2016 11:48:50 GMT",
"Connection": "close",
"Paypal-Debug-Id": "eabb84d3ef438",
"PROXY_SERVER_INFO": "host=dcg12javapapi7866.dcg12.slc.paypalinc.com;threadId=704",
"Content-Type": "application/json"
}
}

Items in the images array of the facebook photo object does not contain a source anymore

We were using photo's from facebook in our application until we noticed today that there was no longer a source field available for the different sizes of the image.
I saw in the facebook documentation that there should be a field "source" for every item in the images array.
images | The 4 different stored representations of the photo |
Requires access_token | array of objects, containing height, width,
and source fields
Here's the json data i get from facebook:
{
"id": "10150916781197589",
"from": {
"name": "Thomas Dekiere",
"id": "641457588"
},
"name": "antwerpen",
"picture": "http://photos-b.ak.fbcdn.net/hphotos-ak-snc7/383569_10150916781197589_641457588_12988491_2098011643_s.jpg",
"source": "http://a2.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/383569_10150916781197589_641457588_12988491_2098011643_n.jpg",
"height": 720,
"width": 478,
"images": [
{
"width": 1360,
"height": 2048
},
{
"width": 637,
"height": 960
},
{
"width": 478,
"height": 720
},
{
"width": 318,
"height": 480
},
{
"width": 212,
"height": 320
},
{
"width": 180,
"height": 271
},
{
"width": 86,
"height": 130
},
{
"width": 86,
"height": 130
}
],
"link": "http://www.facebook.com/photo.php?fbid=10150916781197589&set=a.10150916780582589.528576.641457588&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"created_time": "2012-04-04T13:42:09+0000",
"position": 1,
"updated_time": "2012-04-04T13:42:19+0000"
}
as you can see, there's no source field in the images array items.
Is this normal behavior now and is the documentation out dated or is this a facebook bug?
There was a bug in the facebook service:
http://developers.facebook.com/bugs/328741343854109
It has been solved :)