Skip to content
PubIndexAPI

API Responses

This page aims to help you understand the structure and components of the API responses you’ll receive when working with the Pub Index API.

Response Components

API responses from the Pub Index API can include the following components:

ComponentDescription
sizeThe size in bytes of the feed/sitemap, represented as an integer.
sizeChangedA boolean value indicating whether the feed/sitemap size value has changed or remained the same.
webSubPingSuccessA boolean value indicating if the WebSub API endpoint was successfully notified. Only present if sizeChanged is true.
googlePingSuccessA boolean value indicating if the Google API endpoint was successfully notified. Only present if sizeChanged is true.

Response Examples

New Content / Changed Feed Size (/api/rss, /api/sitemap)

If the API call is successful and detects a changed feed or sitemap size, the response will look like this:

{
  "size": 12345,
  "sizeChanged": true,
  "webSubPingSuccess": true,
  "googlePingSuccess": true
}

In this case, the feed/sitemap size has changed, and both WebSub and Google were successfully notified of the new content.

No New Content / Unchanged Feed Size (/api/rss, /api/sitemap)

If the API call is successful but the feed size remains the same, the response will look like this:

{
  "size": 12345,
  "sizeChanged": false
}

As the feed size has not changed, the API does not fetch the WebSub or Google API endpoints.

Forced Ping Responses (/api/ping)

For instances when you are sure there is new content which has been published you can simply call the /api/ping endpoint.

If you use the /api/ping endpoint, the API will send a ping to both WebSub and Google, regardless of whether the feed size has changed or not.

Unless there is an error, the response for this endpoint will always look like this:

{
  "webSubPingSuccess": true,
  "googlePingSuccess": true
}

This indicates that both WebSub and Google were successfully notified.

Handling Errors

In the event of an error, the API response will include an error code and message. For more information on how to handle errors and troubleshoot common issues, please refer to the Errors & Troubleshooting page.