Cloud Vision: What gets billed, the call or the successful completion of the call? - google-vision

We are just thinking whether to validate some input for google vision (OCR).
We can either throw everything at google vision and check the result, or we validate client side and hope to minimize BadRequest responses.
For us it depends on whether google vision would charge for a BadRequest, like image too large or of the wrong type.
I can't find it the documentation. Does anyone know?

Related

Whatsapp Cloud API Save Session Attributes

I am creating a component in AWS Lambda that is responsible for receiving a WhatsApp message, retrieving the text and sending it to another system.
This other system is capable of connecting to multiple cognitive engines, recovering the user's intention and generating a correct response.
Before getting into the trouble of saving information in DynamoDB, I wanted to find out if it was possible to save a field in the Whatsapp session.
I've read the documentation and I've done a lot of research on the Postman provided by Meta and I don't see how to do it or if it's possible to do it.
Basically I need to save a session id from the other system to be able to keep up with the conversation.
I've read a lot of the documentation and I don't see anything that can help me.
API Whats App Cloud
Thank you very much for the help.

Having problem Charging cards with Paystack js

I have been trying to integrate Paystack for a while and I got stuck in the card charging phase. After submitting the form, my code returns and error that says readPin() is not defined. Paystack asked me to programmatically pass the pin provided by my customer and I don't even know what that is. What do they mean by the pin provided by customer? Will be glad if anyone can help?
what programming language are you using? What have you tried so far? It is best to provide a code sample and the exact response you get when you make the request.
(it's good practice to provide as much detail as possible when asking questions on StackOverflow.)
However, what I suppose it means is that when you collect the PIN provided by the customer, you should make a POST request to https://api.paystack.co/charge/submit_pin with the collected PIN.
Here is the API reference for that at https://developers.paystack.co/v1.0/reference#submit-pin.
You can also reach out directly to Paystack via your Paystack Dashboard > Get Help (on the bottom right corner) for quicker resolution.

Get client_id/client_secret From Tesla Motors API

I'm making an app to keep track of things like miles driven, Kwh used, etc. But I'm having a hard time figuring out how to get a client_id and client_secret being that the API is unofficial.
Here's the Apiary with the API details:
http://docs.timdorr.apiary.io/#reference/authentication/tokens/get-an-access-token?console=1
Anyone know how to generate them? or is everyone else that makes an app for an unofficial API just making a random string for those?
The apiary web site tells you to use the following values.
"client_id”: "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384",
"client_secret": "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3",
Another option would be to use the Smartcar's API! The cliend_id and client_secret appear on your dashboard once you sign up (https://smartcar.com), it is very easy to find them. The API also allows you to do other stuff like locking and unlocking the tesla, finding the location, etc.
You can also check the Odometer API endpoint page to learn more about how you can get the miles driven here (https://smartcar.com/product/odometer/).

Don’t get any measuring data from iHealth cloud (sandbox)

I write an application that uses the api of iHealth. Scales, blood pressure monitor, and devices like that by iHealth send there data with Bluetooth and smartphone apps to the internet cloud of iHealth. Therefore a user of this devices has a user account in the iHealth internet cloud. There he can login and see his data. My app uses the iHealth api to get the data from this cloud. The user of the devices gives mi the right to access his data by OAuth 2 and after receiving the access data I ask for the data of the user with the given client id.
Well, here comes the problem. As a result I get a JSON-Object of measuring data without any data. That means there is no error message, everything seems fine, except that there are no data of this user. It's no kind of error documented here:
sandbox.ihealthlabs.com/dev_documentation_ResponseFormatAndErrors.htm
Http status is good too (200).
I don't use any optional restrictions like asking for data of only certain time.
An explication would be that the user still hasn't used his devices and the cloud therefore doesn't has any data. Unfortunately this is something I can't influence: My app is still not ready and therefore I only use the sandbox cloud offered for development (http://sandbox.ihealthlabs.com).
The sandboxuser can't use the smartphone apps and therefore I can only read the data that are yet there in the cloud. Of course I can't test without data. Who could develop without reciving data? There has to be an error. Maybe a rather silly error. I asked more than 9 days ago the support but still haven't got any answer.
Getting JSON data from the cloud with the api for blood pressure (openApiBP) (the XX-parts are abbreviated id, token, ...):
http://sandboxapi.ihealthlabs.com/openapiv2/user/d7XX..XX9f/bp.json/?client_id=a6XX..XXbe&client_secret=2bXX..XX3f&redirect_uri=http%3A%2F2Flocalhost%3A8082%2FTelemedicina%2Fdispositivos.html%3Fregreso%3DiHealth&access_token=u8XX..XXyw&sv=6cXX..XXcf&sc=deXX..XXcf
The answer to this (w/o any change) is just:
{"BPDataList":[],
"BPUnit":0,
"CurrentRecordCount":0,
"NextPageUrl":"",
"PageLength":50,
"PageNumber":1,
"PrevPageUrl":"",
"RecordCount":0}
Using the Api for Weight (OpenApiWeight) has the same problem as the OpenApiBP.
I have read the documentation more than once and searched for an explanation in the web.
As you see I ask the api and get this maybe correct but useless answer for development purposes. Any idea? What do I miss?
Update:
An iHealth Lab tecnican answered me. In the sandbox is just now user data. My way of asking and the recifed answer are therefore correct. It's not an error. To get data the application has to be registered for the real world. He didn't explain how to test with this limitation of the sandbox.
I let the the answer of the iHealth Lab api technician speak for itself:
"The sandbox does not provide any actual user data. If you want actual live data you will have to register a new application at developer.ihealthlabs.com."
If this is the answer to my question of why not reciving any data means there is really no data that I could recive.
Thanks to all that tried to help me, especially Scott Lawson. I hope this answer will help others. Knowing this a few days ago would have saved me a lot of time.

Twitter API - Validating Twitter is actually Twitter

I've been looking around at various APIs, and since twitter seems to be a common discussion point, I'll use it as an example.
A lot of APIs are implementing oAuth which is great for allowing the service to authenicate and authorize the application connecting to it, however, from what I have seen there doesnt seem to be a way for the application to verify that Twitter is actually Twitter (and not a man in the middle based attack)? I would expect to see some kind of signature (using a shared / public key) of the response body which I can use to validate that twitter signed it.
Is it just because currently there isnt really a point to a man in the middle attack with twitter tweets since currently, whats the worst that can happen (and why would someone want to give me invalid tweets)
On this point, if you were to sign the response, what method would you use? Im currently considering a HMAC-SHA1 signature of the response body using a shared key.
This is what the 'trust' part of SSL does.
-- Edit
I note this has been downvoted, but it's important that other readers realise it's due to a personal disagreement, not due to incorrectness.
In the .NET world we use WCF, which has many different security models, including signing (and if desired encrypting) each message/response. This adds up to a non-trivial amount of overhead, but can give you more 'trust' in the security model. You can switch to using binary-serialized data to cut down on the bloat and message size if you desire.
I'm not sure what other Web Service APIs offer in that area, though I'm sure someone else can add further details as needed.