Skip to main content
URL Extractor 5.1 registers ten abilities in the mainwp-url-extractor category. They use the mainwp/ namespace on your MainWP Dashboard. Use these abilities to automate the same work you do on the URL Extractor page: save output formats as templates, collect post and page URLs from Child sites, and export the results.

What You’ll Learn

  • Manage private and shared extraction templates
  • Start an extraction run and track its progress
  • Page through stored records
  • Create one-use TXT and CSV downloads

Prerequisites

  • WordPress 6.9 or later on the MainWP Dashboard site
  • MainWP Dashboard with Abilities API support
  • URL Extractor 5.1 or later, active in MainWP Dashboard
  • An authenticated user with access to the URL Extractor Add-on
  • Completed template migration (see Template migration)
Use an Application Password or the authentication methods in the Abilities API overview. The examples use an Application Password.

Permissions

URL Extractor 5.1 adds four extension permissions. With Team Control, assign them to custom roles to limit what each role can do. Creating or changing a shared template also requires the WordPress manage_options capability. Every run also checks the user’s access to each selected site.

Available Abilities

Discover the abilities and their full input and output schemas:
All ten abilities are marked idempotent. Replace and delete are marked destructive, so WordPress runs them with DELETE, including for previews. Every input property in each schema is required. Send null for optional filters you do not use. Write abilities take a request_ref UUID. Reuse the same request_ref to retry a request safely. Use a new UUID for each new change.

Typical workflow

1

Start a run

Call start-url-extractor-run-v1 with the sites and filters. Save the returned run_ref.
2

Wait for the run to finish

Call get-url-extractor-run-v1 until state is complete, partial, failed, or expired. Save the returned generation.
3

Read or export the results

Page through records with list-url-extractor-records-v1, or create a TXT or CSV export with the run’s generation.
4

Download the file

Open the returned download_url once, before expires_at.

Manage templates

A template stores the Output format and Separator values used for TXT exports. Templates use the same tokens as the URL Extractor page: [post.title], [post.url], [post.date], [post.status], [post.author], [post.website.url], and [post.website.name]. Each template has a template_ref and a revision. The revision changes whenever the template changes.

List templates

Set audience to private, shared, or null for both. limit accepts 1 to 100. When truncated is true, pass next_after_template_ref as after_template_ref to read the next page.

Create a template

Example response:

Replace or delete a template

Replace and delete use a two-step preview and confirm flow:
  1. Send the request with dry_run: true, confirm: false, and preview_token: null. Set if_match to the template’s current revision.
  2. Review the response, then send the same request with dry_run: false, confirm: true, and the returned preview_token.
If the template changes between the two steps, the confirm request fails with HTTP 412. Read the template again and repeat the preview.
The replace ability takes the same confirmation fields plus title, audience, format, and separator. It replaces all four values.

Start an extraction run

A run collects posts and pages from up to 100 sites in the background. MainWP Dashboard stores the results so you can read and export them later. Any status other than publish requires the URL Extractor: Extract Non-Public Posts permission.
Example response:

Track a run

Example response:
Reads and exports recheck your current access to every selected site. Runs that include non-public statuses also require URL Extractor: Extract Non-Public Posts when read or exported. A run stores up to 10,000 records. truncated: true means MainWP Dashboard stopped collecting after reaching a limit. Only the user who started a run can read or export it.

Read records

Each record includes site_id, post_id, title, url, date, status, author, website_url, and website_name. When truncated is true, pass next_after_record_ref as after_record_ref to read the next page.

Create exports

Exports turn a finished run into a TXT or CSV file. Pass the run’s current generation as run_generation. If the run changes after you read it, the export fails with HTTP 412. Exports from a partial or truncated run, or from a run with failed sites, require allow_partial: true. Without it, the request fails with partial_not_ready.

TXT export

The TXT export formats each record with a saved template. Pass the template’s revision as template_generation.

CSV export

The CSV export writes one column per selected field. Choose 1 to 7 of title, url, date, status, author, website_url, and website_name.
Example response:
To protect spreadsheet users, MainWP Dashboard prefixes cell values that start with a formula character with an apostrophe. formula_cells_escaped reports how many cells it changed.

Download an export

An identical retry with the same request_ref returns the existing export without extending its expiry or allowing a second download. Use a new request reference to create a new export when needed. Each export can be downloaded once. The link expires 10 minutes after it is created. An export file can be up to 16 MiB (16,777,216 bytes).
  • In a browser: Open download_url while logged in to MainWP Dashboard as the user who created the export. You do not need a REST nonce.
  • From a script: Send an authenticated GET request to the REST download endpoint with the artifact_ref.
Downloads still require the URL Extractor: Extract Published Posts permission. A used or expired link returns HTTP 410. Create a new export to download the file again.

Template migration

When you update to URL Extractor 5.1, MainWP Dashboard copies your saved templates to the new template storage in the background. Templates keep their original owner. Older templates that cannot be converted, for example because of a duplicate title or values outside the new limits, are left unchanged. When migration finishes with unconverted templates, administrators see this notice:
MainWP URL Extractor: Compatible saved templates are available. Some older templates could not be converted and have been kept unchanged. No action is needed.
You do not need to edit or delete old templates. Until migration finishes, abilities return storage_unavailable (HTTP 503). The Preview Output workflow on the URL Extractor page keeps working during migration.

Handle errors

MainWP Dashboard also returns its own authentication errors, including HTTP 401 for unauthenticated requests.