Google APIs Force English Response Message - google-sheets

I'm using Google Sheets API to perform actions against the users' spreadsheets after they authenticate, and some of the actions raise errors like:
This action would increase the number of cells in the workbook above the limit of 5000000 cells
or
You are trying to edit a protected cell or object. Please contact the spreadsheet owner to remove protection if you need to edit
In both cases, the API returns `HttpError 400 code and the string value is the only way to distinguish from one another and knowing the specific issue. No error code related to the issue is provided. The problem is that the string comes in different languages according to the user account language settings, making it really hard to map all language possibilities. For example, the message bellow is the equivalent to the one above, but in Spanish instead:
Estás intentando modificar una celda o un objeto protegido. Si necesitas realizar cambios, comunícate con el propietario de la hoja de cálculo para que quite la protección
Is there any parameters on the APIs that enforce the response to be always in a specific language?

Related

Sentence dictionary in Azure cognitive services

I'm having trouble to find the right way to create sentence dictionary using new portal
There is still a way to create one in legacy portal, but no clear examples. Also I'm curious if sentences would take into account grammar. I want to create some translations fron English to Polish which has quite complex grammar and depending on grammatical case and context different output is expected.
We can you the translator dictionary from the new portal too. But we need to take the keys generated from the new portal to custom language translator portal. Let’s walk through the solution.
Part 1: Language translation using Azure portal. Inbuild grammar (not complete)
Go to azure portal and search for a translator
Fill in the details according to the subscription
The above block will convert the English language into Polish according to the requirement. Below is the python code generated for translation. Fill in the details required according to the subscription.
import requests, uuid, json
# Add your key and endpoint
key = "<your-translator-key>"
endpoint = "https://api.cognitive.microsofttranslator.com"
# location, also known as region.
# required if you're using a multi-service or regional (not global) resource. It can be found in the Azure portal on the Keys and Endpoint page.
location = "<YOUR-RESOURCE-LOCATION>"
path = '/translate'
constructed_url = endpoint + path
params = {
'api-version': '3.0',
'from': 'en',
'to': ['fr', 'zu']
}
headers = {
'Ocp-Apim-Subscription-Key': key,
# location required if you're using a multi-service or regional (not global) resource.
'Ocp-Apim-Subscription-Region': location,
'Content-type': 'application/json',
'X-ClientTraceId': str(uuid.uuid4())
}
# You can pass more than one object in body.
body = [{
'text': 'I would really like to drive your car around the block a few times!'
}]
request = requests.post(constructed_url, params=params, headers=headers, json=body)
response = request.json()
print(json.dumps(response, sort_keys=True, ensure_ascii=False, indent=4, separators=(',', ': ')))
Get the keys before going to part 2
Part 2: To add sentence dictionary. Use the custom translator services studio
https://language.cognitive.azure.com/home -> Check into this link
This will create a project where we can choose the language to convert and start the translation with sentence dictionary. By default, sentence dictionary is application in new language translation.

Zendesk Api problem with custom fields values

Good morning,
I need help, I recently found the Tanabee project on github where using APPS Scripts and google sheets and the zendesk api you could extract the necessary info.
I'm looking at the documentation but I can't figure out how to extract the custom fields values.
I get a cell value of "unidentified", could you advise me ?
Attached is the code:
var response = apiRequestToZendesk('tickets.json', '?sort_by=created_at&sort_order=desc&page=' + page),
fetchedTickets = response.tickets
.map(function (ticket) {
return [
ticket.id,
ticket.brand_id,
ticket.subject,
ticket.description.substring(0, 50000),//Limitamos a 50000 caracteres para evitar crash de spreadsheet
ticket.tags.join(','),
toDate(ticket.created_at),
toDate(ticket.updated_at),
/*
ticket.custom_fields_6515116803345
ticket.custom_fields_4419313475857
*/
ticket.custom_fields
];
}),
Thanks everyone
Replace
ticket.custom_fields_6515116803345
with
ticket.custom_fields[ticket.custom_fields.findIndex((cf) => cf.id==6515116803345)].value,

Dailymotion API - Search Restriction

I have a problem on video search. With a French IP, everything works well, but with Ireland IP no.
I try :
https://api.dailymotion.com/user/xm44zy/videos?search=RC%20Lens on French IP -> 500+ results
https://api.dailymotion.com/user/xm44zy/videos?search=RC%20Lens on Ireland IP -> 1 result
Maybe Video access error (DM007 Video geo-restricted by its owner) https://developer.dailymotion.com/api#access-error ?
No because https://api.dailymotion.com/video/x6f8qjq works well. Not found on search query (with Ireland IP) but I have access to the detail of the video
an idea ?
Thanks.
The API will always returns information about a specific video if you request data with its own resource URI (like: https://api.dailymotion.com/video/ID), even if the video is restricted in your country.
However, when using listings (i.e. asking for a video list, or when searching for videos based on search terms), the list will automatically exclude videos which can't be played in your country.
You can know if a video is geoblocked in your country using the "geoblocking" field:
https://developer.dailymotion.com/api/internal#video-geoblocking-field.
In your case, your example is geo-restricted everywhere else France, that's why it won't show in search results (or any listings): https://api.dailymotion.com/video/x6f8qjq?fields=id,title,geoblocking
returns: "geoblocking": [
"allow",
"fr"
]
This means you can only watch it ( and appears in search results ) in France

Cant display rich social media post with og tags

I am having trouble with the og meta tags for social media sharing.
I have links for social media sharing in my app :
= link_to "http://www.facebook.com/share.php?u=#{request.base_url}#{request.env['PATH_INFO']}" do
#i{class: "fa fa-facebook-square social-icon", "aria-hidden"=>"true"}
= link_to "http://www.linkedin.com/shareArticle?mini=true&url=#{request.base_url}#{request.env['PATH_INFO']}&source=#{request.base_url}" do
#i{class: "fa fa-linkedin-square social-icon", "aria-hidden"=>"true"}
= link_to "http://twitter.com/intent/tweet?status=#{request.base_url}#{request.env['PATH_INFO']}" do
#i{class: "fa fa-twitter-square social-icon", "aria-hidden"=>"true"}
each link get the absolute url of the current page and insert it in the sharing url of each specific social media.
I have a notification page with twitter, facebook and linkedn sharing buttons. I have included the following og tags :
- content_for(:page_meta) do
%meta{ property: 'og:title', content: "J’ai voté pour mon lauréat Stars et Metiers" }
%meta{ property: 'og:url', content: laureates_url }
%meta{ property: 'og:description', content: "J’ai voté pour mon lauréat coup de ❤ Stars & Métiers 2016 ! Et vous, quel est votre coup de cœur ? avec lien minimisé vers la page lauréat du site" }
og: url is not the current page url because I dont want the social media post to redirect to the page where the social media buttons where but to a different one (laureates_url)
However I keep getting an error message from each social media that " the page is not found"
What am I doing wrong here ?
UPDATE
after using the facebook debugger with my url :
https://developers.facebook.com/tools/debug/og/object/?q=https%3A%2F%2Fstaging-starsetmetiers.herokuapp.com%2Fprix-coup-de-coeur-du-public%2F17701%2Fnotification
It seems that facebook is able to crawl my url. It even shows me a preview of the potential post. Two problems are still unresolved :
1) When I click on the facebook sharing link on my website I dont get the preview as in the facebook debugger. I still get a page not found error :
2) the debugger tells me
The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
And it is true that in the preview the debugger shows me, it uses the description from the classic meta name= "description". However there is an og:description present in my page that is the description I want to show in my posts and it is present on the page :
<meta content="J’ai voté pour mon lauréat coup de ❤ Stars & Métiers 2016 ! Et vous, quel est votre coup de cœur ? avec lien minimisé vers la page lauréat du site" property="og:description">
How can I fix these problems ?
Thanks for sharing the output of your page in the Facebook debugger as I suggested in my comment. For your two questions,
It looks like there is a stray closing parenthesis in your Facebook share link. If you remove it, the page should be found normally.
It does look like your meta tags are properly labelled with the Open Graph properties (og:url, etc), so I don't understand why the crawler isn't picking it up. The only thing I can think of is that the order of the property and content attributes in the meta tag is in the reverse order of the example shown on the Facebook site, but I doubt that matters...

How do Aweber and FeedBlitz report subscriber numbers to Feedburner?

I've looked all over for some documentation on this, but haven't found it. Some posts reference a user-agent string:
http://groups.google.com/group/feedburner-services/browse_thread/thread/7aee14cf6a2432e7/49464335d2228e25?lnk=gst&q=aweber#49464335d2228e25
I had assumed there would be an API or something. More generally, how does ANY rss feed reader/aggregator (like Bloglines, etc) report subscriber numbers to Feedburner?
I'm working on developing a new app that would need this functionality.
Thanks for your help!
Brian
As you discovered in your link, you put the subscriber count in your user-agent, then you contact the Feedburner Support Group and tell them what format you will be using.
The consensus format is something
User-agent: Service Name (http://example.com/service/info/; ### subscribers ; [optional feed identifier] )
The optional feed identifier is typically used if you run several different services, and fetch the feed separately for each one; e.g. if you have a mail service and a web-based reader service, with different subscribers, then you might either use:
User-agent: SO Agg/1.3 (http://example.com/SOAgg ; 5000 subscribers ; feed-id=mail-134 )
on request for the mailer, and
User-agent: SO Agg/1.3 (http://example.com/SOAgg ; 2000 subscribers ; feed-id=web-134 )
on the request for the website; or use
User-agent: SO Agg/1.3 (http://example.com/SOAgg ; 7000 subscribers ; )
if your system makes only one request for both services...
You will usually need to specify what IP addresses are authorised to request the feed with that user-agent, as well.
Many major aggregators report user stats by including them as part of the useragent string. Examples:
Bloglines reporting description in blog comment
Google Reader: Tips for Publishers
PostRank: Reporting Subscription Counts
There's no standard for this at this time.
To the best of my knowledge, folks will contact major feed analytics vendors like Feedburner directly, to make sure their useragent-based reporting is being counted.

Resources