Skip to content
Last updated

API Recipe: Update Audit Starting URLs

Overview

In your ObservePoint Audits, you may want to change the starting URLs for various reasons:

  • Ensure high priority pages get audited
  • Ensure landing pages get audited that are not linked from your home page or sitemap
  • Validate new pages before they are linked publicly
  • Validate QA environments with dynamic URLs (e.g., Vercel test environments)
  • Create many audits automatically, one per website you want to govern

This recipe updates an existing audit, but you can adapt this recipe to create new audits as well.

Implementation

Step 1: Find your Audit ID

Find your Audit ID manually from the ObservePoint application or query the API:

  • Manually (useful for one-time testing): You can find the Audit ID in the ObservePoint application under "Data Sources" or in Reports --> "Recent Audit Runs". Click on the Audit you want, note the Audit ID and Run ID in the address bar.

  • From the API: You can query the API at GET https://api.observepoint.com/v3/web-audits to get the list of Audits in your account. You can also use the grid API to get audits.

Step 2: Get your Audit object

Make an authenticated GET request to this URL to get the full current configuration of your Audit, including the starting URLs:

Get Audit Configuration
GET https://api.observepoint.com/v2/web-audits/{auditId}

This will return a JSON object that describes the audit configuration, like the following:

Example Audit Configuration
{
  "name": "My Audit Name",
  "startingUrls": [
    "https://example.com/page1",
    "https://example.com/page2"
  ],
  "id": 1390894,
  ...
}

Step 3: Replace the starting URLs

Replace the startingUrls attribute with an array of valid URL strings, while keeping all other attributes unchanged. Optionally, you can also update the limit attribute to match the number of URLs in startingUrls. This ensures the audit only scans those specified pages without crawling additional ones.

Step 4: Send updated Audit configuration to ObservePoint

Make a PUT call with the Audit object created above to the following endpoint:

Update Audit with New Configuration
PUT https://api.observepoint.com/v2/web-audits/{auditId}
PUT Payload for the above URL
{
  // Keep all other attributes as they are
  "startingUrls": [
    "https://example.com/page3",
    "https://example.com/page4"
  ],
  // (optiona) If you want ObservePoint to visit *only* the starting URLs, set the
  // limit equal to the number of starting URLs:
  //"limit": 2,
  ...
}

ObservePoint will validate all the starting URLs you specify, and if any are invalid, the PUT request will return a 422 status code, and the audit will not be updated.

(Optional) Step 5: Start Audit

Make an authenticated POST request to this URL with an empty payload to start the Audit:

Start Audit
POST https://api.observepoint.com/v2/web-audits/{auditId}/runs