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)
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:
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
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
Replace or delete a template
Replace and delete use a two-step preview and confirm flow:- Send the request with
dry_run: true,confirm: false, andpreview_token: null. Setif_matchto the template’s currentrevision. - Review the response, then send the same request with
dry_run: false,confirm: true, and the returnedpreview_token.
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.
Track a run
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
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 currentgeneration 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’srevision as template_generation.
CSV export
The CSV export writes one column per selected field. Choose 1 to 7 oftitle, url, date, status, author, website_url, and website_name.
formula_cells_escaped reports how many cells it changed.
Download an export
An identical retry with the samerequest_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_urlwhile 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.
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.
Related Resources
- URL Extractor - Extract and export URLs from the Dashboard
- Abilities API Overview - Authentication and request formats
- Team Control - Assign Add-on permissions to custom roles
