400 Error in People API [people.updateContact ] - google-api

400 Error in People API [people.updateContact]
I'm need updateContact field locations of user in g-suite
i get 400 error "Resource name "people/{xxxxxxx}" is not a valid contact person resource."
request
{
"resourceName": "people/xxxxxxxxxxx",
"etag": "xxxxxxxxxxxxxx",
"locations": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "xxxxxxxxxxxxxxxx"
}
},
"value": "TestA",
"current": true
},
{
"metadata": {
"source": {
"type": "PROFILE",
"id": "xxxxxxxxxxxxxxxxx"
}
},
"value": "TestB"
}
]
}
response
{
"error": {
"code": 400,
"message": "Resource name \"people/{xxxxxxx}\" is not a valid contact person resource.",
"status": "INVALID_ARGUMENT"
}
}

Answer:
The error "Resource name \"people/{xxxxxxx}\" is not a valid contact person resource." appears because the resource name you are providing in your request is not a valid contact person resource.
Fix:
Replace people/{xxxxxxx} with a valid resource. You can obtain these using people.listDirectoryPeople endpoint.

Related

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.

NEAR transaction without receipt but with receipt_outcome

When querying archival node for transactions with EXPERIMENTAL_tx_status method, some transactions have no receipts while having receipts_outcome. How is that possible, and how is that transaction different from others?
If I understand correctly, receipts_outcome are the results of applying receipts. According to explorer, this transaction has Convert Transaction To Receipt part, so there should be some receipts generated.
According to documentation
A Receipt is the only actionable object in the system. When we talk about "processing a transaction" on the NEAR platform, this eventually means "applying receipts" at some point.
A good mental model is to think of a Receipt as a paid message to be executed at the destination (receiver). And a Transaction is an externally issued request to create the Receipt (there is a 1 to 1 relationship).
My query
{
"jsonrpc": "2.0",
"id": "2",
"method": "EXPERIMENTAL_tx_status",
"params": ["7beNxrbHxMRspJWT9NeEVwx719kVcmY9tRdPG9SYro26", "bumbleee99.near"]
}
Response
{
"jsonrpc": "2.0",
"result": {
"status": {
"SuccessValue": ""
},
"transaction": {
"signer_id": "bumbleee99.near",
"public_key": "ed25519:DFM5GRGbpNkk4XkhcFnRUFeKG8a3nzTH8NwZp754pC48",
"nonce": 59080995000003,
"receiver_id": "bumbleee99.near",
"actions": [
{
"AddKey": {
"public_key": "ed25519:CUoNs153GHrPZ9F8HpvhzFr1mwuUFUdGQsRNE2CTNjVH",
"access_key": {
"nonce": 0,
"permission": "FullAccess"
}
}
}
],
"signature": "ed25519:15v34qoyCHSvSL5uLcaPqD9vXvjcPrCaZVStCMms8e58C62z2UHiazwUXzHajPEgdHpwn7s4J9dd5UPmtvzbYgM",
"hash": "7beNxrbHxMRspJWT9NeEVwx719kVcmY9tRdPG9SYro26"
},
"transaction_outcome": {
"proof": [
{
"hash": "ECKDm5FVhzit7Wqs9sEyBB9NtuTrVRZmWwcxkkg2yUh4",
"direction": "Right"
},
{
"hash": "E4VXdwsNj3fZCbP6y9YH3M5oZHPDcdArqU9kbZJa95Qp",
"direction": "Right"
}
],
"block_hash": "ASY6HgDUQUXUa99L7dPEfghKEnEk5SNkwQrx24u3Fobz",
"id": "7beNxrbHxMRspJWT9NeEVwx719kVcmY9tRdPG9SYro26",
"outcome": {
"logs": [],
"receipt_ids": [
"JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
],
"gas_burnt": 209824625000,
"tokens_burnt": "20982462500000000000",
"executor_id": "bumbleee99.near",
"status": {
"SuccessReceiptId": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
},
"metadata": {
"version": 1,
"gas_profile": null
}
}
},
"receipts_outcome": [
{
"proof": [
{
"hash": "8RwCWE9HgqenPKv8JW9eg2iSLMaQW82wvebYSfjPbdTY",
"direction": "Left"
},
{
"hash": "E4VXdwsNj3fZCbP6y9YH3M5oZHPDcdArqU9kbZJa95Qp",
"direction": "Right"
}
],
"block_hash": "ASY6HgDUQUXUa99L7dPEfghKEnEk5SNkwQrx24u3Fobz",
"id": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ",
"outcome": {
"logs": [],
"receipt_ids": [],
"gas_burnt": 209824625000,
"tokens_burnt": "20982462500000000000",
"executor_id": "bumbleee99.near",
"status": {
"SuccessValue": ""
},
"metadata": {
"version": 1,
"gas_profile": []
}
}
}
],
"receipts": []
},
"id": "2"
}
You could see that both transaction_outcome.outcome.receipt_ids and transaction_outcome.outcome.status are pointing to a receipt with ID JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ. I've tried querying node about this receipt with EXPERIMENTAL_receipt method like this
{
"jsonrpc": "2.0",
"id": "2",
"method": "EXPERIMENTAL_receipt",
"params": {"receipt_id": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"}
}
yet the node returns error indicating, that there is no receipt with given ID
{
"jsonrpc": "2.0",
"error": {
"name": "HANDLER_ERROR",
"cause": {
"name": "UNKNOWN_RECEIPT",
"info": {
"receipt_id": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
}
},
"code": -32000,
"message": "Server error",
"data": {
"name": "UNKNOWN_RECEIPT",
"info": {
"receipt_id": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
}
}
},
"id": "2"
}
TL;DR the receipt is a local receipt
The transaction from your example is a simple AddKey action where the sender is the receiver (remember this, it's important)
"Execute" transaction (means to convert the transaction into a Receipt)
Apply the Receipts
As the result of the conversion of the transaction into a receipt is your transaction_outcome
"outcome": {
"receipt_ids": [
"JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
],
"status": {
"SuccessReceiptId": "JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ"
},
This receipt is about to be applied and the predecessor_id and the receiver_id are equal. In nearcore such receipts are called local receipts (sir - sender-is-receiver) and those receipts are not stored in the nearcore database.
We emulate them on NEAR Indexer Framework side (that's why you can see Receipt JDnBrxh6L9KFgVUEg6U8d39rEUEmbvLQ5tZQUmJTMyFJ on the transaction details page on NEAR Explorer)
And because nearcore doesn't store such receipts in the database you got UNKNOWN_RECEIPT from the RPC.

"Requested entity was not found" when writing on Google Home Graph

I'm trying to update the state of a device using Google Home Graph API, but I'm getting this reply and I don't understand why:
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
}
This is the first part of my SYNC reponse:
{
"requestId": "reqId",
"payload": {
"agentUserId": "myAgentUserId",
"devices": [
{
"id": "myDeviceId",
...
}
and this is what I'm sending to
https://homegraph.googleapis.com/v1/devices:reportStateAndNotification
{
"agentUserId": "myAgentUserId",
"payload": {
"devices": {
"states": {
"myDeviceId": {
"on": true
...
}
As you can see, both myAgentUserId and myDeviceId in Home Graph's request are the same to the ones returned to the SYNC request.
What am I doing wrong?

YouTube API subscription insert always returns an error

How to Add a subscription for the authenticated user's channel
https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
Request Parameters :-
{
"0":
{ "name": " <code>snippet.resourceId.kind</code>", "value": "youtube#channel" },
"1": { "name": " <code>snippet.resourceId.channelId</code>", "value": "UC_x5XG1OV2P6uZZ5FSM9Ttw" }
}
Response Parameters :-
{
"error":
{ "errors":
[ { "domain": "youtube.subscription", "reason": "publisherRequired", "message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to." } ], "code": 400, "message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to." }
}
This apears to be a bug in the Youtube api. this can be verifyed by checking the api explorer here .
POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
{
"0": {
"name": "snippet.resourceId",
"value": "youtube#channel"
},
"1": {
"name": "snippet.resourceId",
"value": "UC_x5XG1OV2P6uZZ5FSM9Ttw"
}
}
Response
{
"error": {
"errors": [
{
"domain": "youtube.subscription",
"reason": "publisherRequired",
"message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to."
}
],
"code": 400,
"message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to."
}
}
There is an issue request for this issue and the team has been pinged.
Link of Youtube Data API (V3), you can try here
it's the image example in "try this API" of how i do
POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"snippet": {
"resourceId": {
"kind": "youtube#channel",
"channelId": "UCUK0HBIBWgM2c4vsPhkYY4w"
}
}
}

Resources