Calling "Campaign Manager 360 API -> conversions.batchinsert " and getting all the time the error "code": "NOT_FOUND" - google-api

I am trying to create conversions using "Method: conversions.batchinsert" from the API Explorer provided by google on the same API page.
I do not why I am getting the error with code 200
Request
{
"kind": "dfareporting#conversionsBatchInsertRequest",
"conversions": [
{
"timestampMicros": "1635788776043000",
"ordinal": "1635788776043000",
"kind": "dfareporting#conversion",
"floodlightConfigurationId": "12067120",
"floodlightActivityId": "11765909",
"dclid": "testdclid"
}
]
}
Response
{
"hasFailures": true,
"status": [
{
"conversion": {
"floodlightConfigurationId": "12067120",
"floodlightActivityId": "11765909",
"timestampMicros": "1635788776043000",
"ordinal": "1635788776043000",
"kind": "dfareporting#conversion",
"dclid": "testdclid"
},
"errors": [
{
"code": "NOT_FOUND",
"message": "",
"kind": "dfareporting#conversionError"
}
],
"kind": "dfareporting#conversionStatus"
}
],
"kind": "dfareporting#conversionsBatchInsertResponse"
}
```

Related

YouTube Data API Get Channel by Handle

Introducing handles: A new way to identify your YouTube channel
Does the YouTube Data API support querying for a channel by it's #handle? This does not seem to be supported.
ex: https://www.youtube.com/#lionsgatemovies
forUsername param
GET https://www.googleapis.com/youtube/v3/channels?part=id,snippet&forUsername=#lionsgatemovies
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
}
}
id param
GET https://www.googleapis.com/youtube/v3/channels?part=id,snippet&id=#lionsgatemovies
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
}
}
None of the supported filter params seem to be appropriate:
{
"error": {
"code": 400,
"message": "No filter selected. Expected one of: mySubscribers, forUsername, mine, managedByMe, categoryId, id",
"errors": [
{
"message": "No filter selected. Expected one of: mySubscribers, forUsername, mine, managedByMe, categoryId, id",
"domain": "youtube.parameter",
"reason": "missingRequiredParameter",
"location": "parameters.",
"locationType": "other"
}
]
}
}
You can use Search API with q parameter set to #handle
curl \
'https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&q=%40kevinrooke&type=channel&key=[YOUR_API_KEY]'
{
"kind": "youtube#searchListResponse",
"etag": "AYlro9VG2vMtdew4OQiWoQM8Rs0",
"regionCode": "LT",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "ls9E_ctoa-RLsqznJwxWlHHIE1s",
"id": {
"kind": "youtube#channel",
"channelId": "UCTdxV_ItCZMayyzGkw7P_qQ"
},
"snippet": {
"publishedAt": "2017-05-27T03:56:38Z",
"channelId": "UCTdxV_ItCZMayyzGkw7P_qQ",
"title": "Kevin Rooke",
"description": "Interviews with the builders bringing the Lightning Network to life. ⚡kerooke#fountain.fm.",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/ytc/AMLnZu-SpmaNjx7KOMqs5Cr7ZthU60BaQApzt89_dHOlcg=s88-c-k-c0xffffffff-no-rj-mo"
},
"medium": {
"url": "https://yt3.ggpht.com/ytc/AMLnZu-SpmaNjx7KOMqs5Cr7ZthU60BaQApzt89_dHOlcg=s240-c-k-c0xffffffff-no-rj-mo"
},
"high": {
"url": "https://yt3.ggpht.com/ytc/AMLnZu-SpmaNjx7KOMqs5Cr7ZthU60BaQApzt89_dHOlcg=s800-c-k-c0xffffffff-no-rj-mo"
}
},
"channelTitle": "Kevin Rooke",
"liveBroadcastContent": "none",
"publishTime": "2017-05-27T03:56:38Z"
}
}
]
}
As of this moment (17th Nov 2022), YouTube has yet to update the Data API with #handle support.
The channelId was scattered around in the Html. You can easily parse them after fetching the url with the handle.
const html = await(await fetch(url)).text()
const channelId = html.match(/(?<=channelId(":"|"\scontent="))[^"]+/g)[0];
Following is the python snippet while we are waiting for YouTube API's official support. This is inspired by goodhyun's wonderful thoughts.
import requests
import re
# return YouTube channel id via handle or False if failed
def scraping_get_channel_id_from_handle(handle:str):
if handle.find('#') == -1:
handle = '#' + handle
url = 'https://www.youtube.com/' + handle
resp = requests.get(url)
if resp.status_code == 200:
found = re.findall('"channelId":"([^"]*)","title"', resp.text)
return found[0]
else:
return False

google search console api - response error for the search types discover and googleNews

We are trying to get data from the google search console API with dimension types - web, discover, googleNews, news, image, video. They are all listed in the google API documentation here
But we are getting a successful response from google API only for search types 'web', 'image', and 'news', please see it below
Request URL: https://www.googleapis.com/webmasters/v3/sites/sc-domain%3Amydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 239752
========================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "image",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 1827
====================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dimensionFilterGroups": [
{
"groupType": "and",
"filters": [
{
"dimension": "country",
"operator": "contains",
"expression": "GBR"
}
]
}
],
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 9073
When we are making the same request with the search type 'discover' or 'googleNews' we are getting an error in the response as below
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "discover",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
We also have tried to make the API request for the full URL without sc-domain parameter as one below
https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fwww.mydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
But still, we are getting the same errors.
My question is - what is wrong with our requests and how to get data from the google search console API for the search types 'discover' and 'googleNews'? And is there any way to get more informative error messages from google search console API responses, that will provide a bit more explanation about the reason for the error occurred?

Google Ads API - Optimize Campaign By Specific Conversion Action(s)

I am using Google Ads PHP library to create Campaign.
I created almost any type of campaigns but didn't manage to optimize them by specific Conversion Actions.
For example:
I have created 3 different Conversion Actions:
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0]
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1]
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_2]
Then I created a Campaign:
customers/[CUSTOMER_ID]/campaigns/[CAMPAIGN_ID]
I set bidding strategy to MAXIMIZE_CONVERSIONS and then tried to set Conversion Actions to optimize to.
This is my code snippet:
$campaign->setMaximizeConversions(
new CommonMaximizeConversions([
'target_cpa' => $this->convert()->micros(1)
])
);
$campaign->setSelectiveOptimization(
new SelectiveOptimization([
'conversion_actions' => [
'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0]',
'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1]'
]
])
);
It gives me this error:
{
"message": {
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"requestError": "UNKNOWN"
},
"message": "The error code is not in this version.",
"trigger": {
"stringValue": ""
},
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 0
},
{
"fieldName": "create"
},
{
"fieldName": "selective_optimization"
},
{
"fieldName": "conversion_actions"
}
]
}
}
],
"requestId": "xbgMUFFeP4447GFW_nJrIA"
}
]
},
}
Can you tell me what I am doing wrong? Or suggest any help?.
Thanks.

Create Google Tag manager Trigger that fires when {{variable}} == 'false' with GTM API v2

I am trying to create a Google Tag Manager trigger using the GTM API v2.
I'm trying to achieve the following:
I want a trigger to fire on Page view in pages where the variable Mobile or not is false
I tried to call the API with these parameters
{
"name": "Desktop Users Test",
"type": "pageview",
"filter": [
{
"parameter": [
{
"type": "template",
"value": "{{ Mobile or not }}",
"key": "arg0"
},
{
"type": "boolean",
"value": "false",
"key": "arg1"
}
],
"type": "equals"
}
]
}
But it returning a 400 Bad Request error with this response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Unable to parse trigger data"
}
],
"code": 400,
"message": "Unable to parse trigger data"
}
}
If I create a trigger with only name, type and empty filters it works
{
"name": "Will work too",
"type": "pageview",
"filter": []
}
// will return a "200 OK" response
Please, what are the right parameters to create this trigger?

Google compute engine API:backendError(503)

I am having trouble figuring out the problem with the API hit to create a Google virtual machine through Google Compute Engine API.
URL: https://cloud.google.com/compute/docs/reference/latest/instances/insert?apix=true#examples
My request data is:
{
"machineType": "zones/us-central1-c/machineTypes/f1-micro",
"name": "api-test",
"networkInterfaces": [
{
"accessConfigs": [
{
"type": "ONE_TO_ONE_NAT",
"name": "External NAT"
}
],
"network": "global/networks/default"
}
],
"disks": [
{
"boot": true,
"autoDelete": true,
"type": "SCRATCH"
}
]
}
and I am getting output:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Code: '55C355EC47648.A8E5D85.FA0DAF10'"
}
],
"code": 503,
"message": "Code: '55C355EC47648.A8E5D85.FA0DAF10'"
}
}
Doesn't give me any reason for the error. Same issue is when I hit the API using Ruby Library. Authentication is fine as I can do various other stuff like getting the images and running instances data. Please help me out.
Figured out the problem. We have to use the disks type as "PERSISTENT" rather than "SCRATCH" and specify the disks["initializeParams"]["sourceImage"] as an existing image from https://console.cloud.google.com/compute/images and then use it like this in the request body of your request:
{
"name": "api-test3",
"machineType": "zones/us-central1-c/machineTypes/f1-micro",
"networkInterfaces": [
{
"accessConfigs": [
{
"type": "ONE_TO_ONE_NAT",
"name": "External NAT"
}
],
"network": "global/networks/default"
}
],
"disks": [
{
"boot": "true",
"type": "PERSISTENT",
"autoDelete": "true",
"initializeParams": [
{
"sourceImage": "global/images/ubuntu-1404-lts"
}
]
}
]
}

Resources