How can I test the Google Translate API with cURL? - api

I'm attempting to use cURL to test the Google Translate API to see if it will suit my needs. But when I run this
$ curl https://www.googleapis.com/language/translate/v2?key=mykeyhere&source=en&target=de&q=Hello
I receive this in response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: q",
"locationType": "parameter",
"location": "q"
},
{
"domain": "global",
"reason": "required",
"message": "Required parameter: target",
"locationType": "parameter",
"location": "target"
}
],
"code": 400,
"message": "Required parameter: q"
}
}
Any ideas what I am doing wrong?
(Also, I understand StackOverflow may not be the best place for the question. I am happy to request that this question be moved to a different StackExchange site if someone will be kind enough to suggest an appropriate site for this question.)

I ended up using this NPM package to test, and once I enabled billing in the Google Developer Console, things worked: https://www.npmjs.org/package/google-translate

Related

Creating Alias Via Admin SDK API for secondary domain

Running a POST with the following:
https://www.googleapis.com/admin/directory/v1/users/{{userid}}/aliases/
With the following as the body in JSON
{
"alias":"person#gsuite.company.com"
}
Im just getting the following error
{
"error": {
"code": 400,
"message": "Invalid Input: alias_email",
"errors": [
{
"message": "Invalid Input: alias_email",
"domain": "global",
"reason": "invalid"
}
]
}
}
I would love some help on this because its getting super frustratinu
Google Support Page
https://developers.google.com/admin-sdk/directory/v1/guides/manage-user-aliases
See comments above, but always give your secondary domains in Google Workplace an alias to the main domain and the domain alais will appear

Blogger API We're sorry, but the value for field labels was not valid

When I submit the following json format article to blogger
{
"title": "Title",
"content": "Content",
"labels":["adventviures", "3ds", "game", "nintendo", "bgr", "metroid", "to", "fox", "Balrog", "bgr", "avi", "review", "addicted", "pikmin", "balrog", "bngr", "bgra", "eshop", "new 3ds", "star", "pokemon", "balrogthemaster", "mario", "thoughts", "on"]
}
I get the following error message
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "We're sorry, but the value for field labels was not valid."
}
],
"code": 400,
"message": "We're sorry, but the value for field labels was not valid."
}
Some other labels do not work
1."labels":["CauBeNguNgo","Xe Đua","GTA 5","Thành Trung Gaming","Xe Lamborghini","siêu xe đua","game offline","Cris Devil GamerGame Offline"]
2."labels":["Google israel","Google","entertainment","YouTube Japan 公式チャンネル","YTMA","YouTube","Science & Technology","エンタメ","entame","Awards","YouTube Japan","Music"]}
I would like to know if the blogger's labels comply with the rules, I do not find it
Please help me

Google API Gmail error 500 Internal error encountered

I try send request https://gmail.googleapis.com/gmail/v1/users/me/messages/ using Postman, but I get:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"message": "Internal error encountered.",
"domain": "global",
"reason": "backendError"
}
],
"status": "INTERNAL"
}
}
Could somebody help me with this issue?
Please use this tool[1] to check your domain, most likely there are some critical problems detected within this domain. Mail-flow is probably affected.
Also check this documentation[2] on domain nameservers.
[1]https://toolbox.googleapps.com/apps/checkmx/
[2]https://support.google.com/a/answer/2573637#H

Not able to create Tag in Google Tag Manager using the Google Tag Manager API

I want to use the Google Tag Manager API to programmatically create Tags in a containers workspace from a JSON file.
In doing so I encountered the following error after sending of a create-Request:
{
"errors": {
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
I then tried to create a minimal tag in the same workspace following this example: https://developers.google.com/tag-manager/api/v2/devguide with the same result.
Its the same for another newly created container and workspace with no other elements in it.
Does someone know a possible solution? Thanks in advance.

UDFs with the php api library

I am trying to add a UDF (I've tried both options of inline vs on cloud storage) and always get the same messsage:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidQuery",
"message": "Unknown TVF: funcName",
"locationType": "other",
"location": "query"
}
],
"code": 400,
"message": "Unknown TVF: funcName"
}
}
I set the resource via.
$udf_resource = new Google_Service_Bigquery_UserDefinedFunctionResource();
$udf_resource->setResourceUri('gs://path/to/bucket/funcName.js');
or
$udf_resource = new Google_Service_Bigquery_UserDefinedFunctionResource();
$udf_resource->setInlineCode("FUNC_NAME_CODE");
both are being inserted into a job query config via.
$query_config->setUserDefinedFunctionResources($udf_resource);
The udf runs fine via. the Web UI.
Is there something I am missing?
passing array to setUserDefinedFunctionResources(), e.g.
$query_config->setUserDefinedFunctionResources([$udf_resource]);