google-api-php-client icon indicating copy to clipboard operation
google-api-php-client copied to clipboard

Indexing API is not Returning result for latestupdate

Open chiragvels opened this issue 1 year ago • 4 comments

Environment details

  • OS: Linux
  • PHP version: 8.1
  • Package name and version: v2.17.0

Steps to reproduce

  1. https://indexing.googleapis.com/batch use with Google_Service_Indexing
  2. Google_Service_Indexing_UrlNotification to get response

Code example

$response_meta = $result->getUrlNotificationMetadata();

if ($response_meta) {
    $response_latest_update = $response_meta->getLatestUpdate();
    
    if ($response_latest_update) {
        $response_url = $response_latest_update->getUrl();
        $response_type = $response_latest_update->getType();
        $response_notify_type = $response_latest_update->getNotifyTime();
        
        echo 'URL: ' . $response_url . PHP_EOL;
        echo 'Type: ' . $response_type . PHP_EOL;
        echo 'Notify Time: ' . $response_notify_type . PHP_EOL;
    } else {
        echo 'No latest update found for this URL.' . PHP_EOL;
    }
} else {
    echo 'No metadata found for this URL.' . PHP_EOL;
}

I am not getting $response_latest_update response.

Response is only this:


Google\Service\Indexing\UrlNotificationMetadata Object
(
    [latestRemove] => 
    [latestRemoveType:protected] => Google\Service\Indexing\UrlNotification
    [latestRemoveDataType:protected] => 
    [latestUpdate] => 
    [latestUpdateType:protected] => Google\Service\Indexing\UrlNotification
    [latestUpdateDataType:protected] => 
    [url] => https://example.com/blog
    [internal_gapi_mappings:protected] => Array
        (
        )

    [modelData:protected] => Array
        (
        )

    [processed:protected] => Array
        (
        )

)

Reference:

https://developers.google.com/search/apis/indexing-api/v3/reference/indexing/rest/v3/UrlNotificationMetadata

https://developers.google.com/search/apis/indexing-api/v3/reference/indexing/rest/v3/urlNotifications#UrlNotification

Thanks!

chiragvels avatar Sep 19 '24 07:09 chiragvels

Have the same issue Responce before:

{
  "urlNotificationMetadata": {
    "url": "https://example.com",
    "latestUpdate": {
      "url": "https://example.com",
      "type": "URL_UPDATED",
      "notifyTime": "2022-08-13T03:20:59.809808055Z"
    }
  }
}

Responce now:

{
  "urlNotificationMetadata": {
    "url": "https://upup.tools"
  }
}

It is serialized responce objects tha i save in db

bubaololo avatar Sep 22 '24 07:09 bubaololo

when I hit this api

POST https://indexing.googleapis.com/v3/urlNotifications:publish with body :

{
    "url": "https://kunfirm.me/jobs/Abia/Aba/66de5c3d8559681b41aadaf5/view",
    "type": "URL_UPDATED"
}

I get this response

{
  urlNotificationMetadata: {
    url: 'https://kunfirm.me/jobs/Abia/Aba/66de5c3d8559681b41aadaf5/view'
  }
}

but when I try to get update about this url to check if I successfully submitted this url through this api

GET https://indexing.googleapis.com/v3/urlNotifications/metadata?url=https%3A%2F%2Fkunfirm.me%2Fjobs%2FAbia%2FAba%2F66de5c3d8559681b41aadaf5%2Fview

{
    "error": {
        "code": 404,
        "message": "Requested entity was not found.",
        "status": "NOT_FOUND"
    }
}

I've tried different Urls I always get the same response. I've gone through the docs and followed each step carefully. The user has owner permission. Still unable to find out the issue.

Parshant7 avatar Oct 04 '24 05:10 Parshant7

facing the same issue with URL_DELETED

faisal-saddique avatar Oct 10 '24 08:10 faisal-saddique

Same issue here! Additionally when trying to fetch information about a url that I recently indexed using this API with the following code var_dump($service->urlNotifications->getMetadata(["url" => $urlAsString]));, I get the following output: Caught exception: { "error": { "code": 404, "message": "Requested entity was not found.", "errors": [ { "message": "Requested entity was not found.", "domain": "global", "reason": "notFound" } ], "status": "NOT_FOUND" } }

I still get that output more than 48 hours later and here is a thread where someone experienced a similar issue (from a users point of view): https://support.rankmath.com/ticket/error-404-requested-entity-was-not-found-instant-indexing/ The company (Rankmath) blames it on the indexing api not being supported for any content other than livestreams and job postings.

reditec avatar Jan 19 '25 15:01 reditec

Still noone has any progress? I just want to automate URL deletion for 404 pages, but I get the same errors (Im using Python)

mmzeynalli avatar May 02 '25 21:05 mmzeynalli