Google Sheets Api v4 getBatch() range limit - spreadsheet

I'm trying to get data from a spreadsheet (59 sheets) using this get request:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchGet
I have noticed that 40 ranges (sheets) is the limit before I get illegal request.
Does anyone know if this is normal behaviour and where it is documented?

I just found out that the issue has to do with the length of the url request. I shortened the name of the sheets and I could fit more into the request.

Related

Unable to POST NZ employee openingBalances to Xero?

I am attempting to create a single opening balances record against an existing employee but keep getting a 400 Bad Request response with this detail...
At least one NZ opening balance item is required in the request
I am following the instructions as per this documentation...
https://developer.xero.com/documentation/api/payrollnz/employeeopeningbalances#post-opening-balances
URL : {DestinationID} is properly replaced with the employee GUIDhttps://api.xero.com/payroll.xro/2.0/employees/{DestinationID}/openingBalances
JSON Body[{"periodEndDate":"2011-01-30T00:00:00","daysPaid":5.00,"unpaidWeeks":0.00,"grossEarnings":1442.31}]
The Xero forums and support is pretty unreliable so I'm posting here in the hopes for a better response.
After some trial and error using the API Explorer that Xero provides I was able to get it working using their example....
I eventually learned that daysPaid and unpaidWeeks must both be integer whole numbers or else it fails.... The error message provided is misleading but this resolves the problem.

Http status code when data not found in Database

I'm trying to understand which Http Status Code to use in the following use case
The user tries to do a GET on an endpoint with an input ID.
The requested data is not available in the database.
Should the service send back:
404 - Not Found
As the data is NOT FOUND in the database
400 - Bad Request
As the data in the input request is not valid or present in the db
200 - OK with null response
200 - OK with an error message
In this case we can use a standard error message, with a contract that spans across all the 200 OK responses (like below).
BaseResponse {
Errors [{
Message: "Data Not Found"
}],
Response: null
}
Which is the right (or standard) approach to follow?
Thanks in advance.
Which is the right (or standard) approach to follow?
If you are following the REST API Architecture, you should follow these guidelines:
400 The request could not be understood by the server due to incorrect syntax. The client SHOULD NOT repeat the request without modifications.
It means that you received a bad request data, like an ID in alphanumeric format when you want only numeric IDs. Typically it refers to bad input formats or security checks (like an input array with a maxLength)
404 The server can not find the requested resource.
The ID format is valid and you can't find the resource in the data source.
If you don't follow any standard architecture, you should define how you want to manage these cases and share your thought with the team and customers.
In many legacy applications, an HTTP status 200 with errors field is very common since very-old clients were not so good to manage errors.

Tegram bot API token format

I want to figure out the format of telegram bot tokens to implement some validity checks, but there seems not official format description.
from my token and what I have found on the net, I can assume the following:
(up to) 46 characters length
starts with (up to) 10 digits followed by :
the remaining 35 characters are of class [[:alnum:]] plus - and _
can anyone (dis) confirm or point to documentation?
Let me summarize what we know so far:
to verify that a telegram API token has the correct format AND is currently valid you must make a Telegram getMe API call, e.g. on command line:
curl -s https://api.telegram.org/botYOURTOKEN/getMe
Nevertheless, we have some good guesses what a correct token must look like:
it consists of 8-10 digits followed by a :
the : is followed by a 35 character Telegram internal identifier/hash
the identifier is consisting of character class [[:alnum:]] plus _-, this fit's the characters documented for the deep linking parameter
Summary:
Token format: 8-10 digits:35 alnum characters plus _- , e.g. 123456789:AaZz0...AaZz9
Regex for testing: /^[0-9]{8,10}:[a-zA-Z0-9_-]{35}$/
If you want to check validity of a bot's token you can use the getMe method.
https://core.telegram.org/bots/api#getme
A simple method for testing your bot's auth token. Requires no
parameters. Returns basic information about the bot in form of a User
object.
Any non valid token will return 401 error.
I believe this would be a more robust approach than checking for correct formats.
The BOT token consists of two parts. In BOT_ID:BOT_ALPHANUMERIC_PART the BOT_ID is 8 to 10 digit long and the BOT_ALPHANUMERIC_PART has a length of 35 characters. So the total length is 43 to 45 characters.
If you want to validate a bot token then you can use: https://api.telegram.org/bot< YOUR_BOT_TOKEN>/getMe.
It will return the JSON data for your bot. It will throw a 401 error if the bot token is not valid.

SQL LIKE '%...' in vba HTTP request

I am trying to run an SOQL query to the Salesforce REST API within a macro in Excel. I am using a LIKE statement to check if there are any email addresses with the same domain, which looks like this:
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%#domain.com'
This is just the parameter given to the HTTP request, domain being a placeholder.
When I run the exact same request using Postman I get the correct response from the server, however in Excel I get Error 400 bad request.
When dropping the % it accepts the request, however then it obviously doesn't find any entries, as it is looking for the exact string "#domain.com".
Are there any known problems with the %-sign within vba? Or any other suggestions what could be the problem?
The problem is not with VBA, it is with your HTTP query. You need to escape the percent sign (%), which is a special characters. I guess Postman is doing this for you under the hood.
Hence, try :
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%25#domain.com'
See : https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_the_percent_character
If that's not enough for the query to succeed, you may as well escape the arobas sign (#):
q=SELECT+email+FROM+Contact+WHERE+email+LIKE+'%25%40domain.com'

IE 11 response payload size

I've a webservice which sends payload in JSON format but the value in one of the key of response json is 7.5MB.
Chrome:
It accept the full response.
IE 11:
It terminates the response.
Is there any limit in IE.
Thanks,
I try to find the documentation which shows the limit but I did not get any documentation about that.
I find one article, In which it shows different test results.
HOW BIG IS TOO BIG FOR JSON?
Test was done with IE 9 and it was able to handle 38 MB of JSON data.
So from that result, We can say that IE 11 can handle at least 38 MB or more data.