مستندات توسعه دهندگان

اعمال اصلاح های یک اکشن

POST/sites/{siteId}/actions/{issueId}/apply
Scope
actions:apply
ابزار MCP
apply

Apply approved values through WordPress Approves new SEO titles, meta descriptions, canonicals or noindex for the pages of one action, writes them through the WordPress connector, then rechecks. The key owner is recorded as approver; undo is in the app for 30 days. A category or tag archive takes an SEO title or meta description when the WordPress plugin supports it; otherwise it is refused with not_writable and the reason. Image alt text and redirects are applied in the app only.

توضیح ها از سند OpenAPI می آیند و انگلیسی اند.

پارامترها

ناممحلتوضیح
siteIdاجباریpathstringWebsite id, from GET /sites.
issueIdاجباریpathstringIssue id of the action, from GET /sites/{siteId}/actions.

بدنه درخواست

فیلدتوضیح
changeslist of object · required; at most 500 items; One change per page, at most 500
changes[].urlstring · required; A page the action lists, a published WordPress item synced to MonoRanks
changes[].valuestring · required; The new value; for noindex, 1 to set it and 0 to remove it
{
  "changes": [
    {
      "url": "https://acmebikes.com/products/trail-pro-29",
      "value": "Trail Pro 29: a light aluminium trail bike with 140 mm travel and a 12-speed drivetrain. Free delivery and 30-day returns."
    }
  ]
}

پاسخ

200 · application/json

فیلدتوضیح
approvedinteger · required; Changes approved
batchIdstring · required; Batch id; see lastChange of the issue
notestring · required; What happens next
linkstring · required; The action in the app

نکته ها

مقدارهایی را که تأیید می کنید با این شکل به POST /sites/{siteId}/actions/{issueId}/apply بفرستید: { "changes": [ { "url": "…", "value": "…" } ] } (حداکثر 500 مورد). apply از طریق API فقط عنوان سئو، توضیحات متا، canonical و noindex را می نویسد؛ متن alt تصویرها و ریدایرکت ها را باید در اپ اعمال کنید.

خطاها

کدمعنی
400Bad request. Codes: field_not_supported, no_changes, not_a_wordpress_post, not_applied.
401Missing, unknown or revoked key. Codes: missing_key, invalid_key.
403The key lacks the scope, covers another website, or its owner lost access. Codes: missing_scope, other_site, owner_left, no_owner, forbidden.
404Not found. Codes: not_found.
422The request cannot be carried out. Codes: not_writable.
429Too many requests this hour for this key. Codes: rate_limited.

نمونه درخواست

curl -X POST \
  -H "Authorization: Bearer mr_ws_…" \
  -H "Content-Type: application/json" \
  -d '{"changes":[{"url":"https://acmebikes.com/products/trail-pro-29","value":"Trail Pro 29: a light aluminium trail bike with 140 mm travel and a 12-speed drivetrain. Free delivery and 30-day returns."}]}' \
  "https://app.monoranks.com/api/v1/sites/SITE_ID/actions/ISSUE_ID/apply"

نمونه پاسخ

{
  "approved": 1,
  "batchId": "f6b8d0f2-4a6c-4e8a-ac2e-6a8cae2a4c6d",
  "note": "Written by the worker, then rechecked. Undo is available in the app for 30 days.",
  "link": "https://app.monoranks.com/sites/3f6c2a1e-8b4d-4c7a-9e21-5d0b7a6f4c13/actions/b2e4c6a8-1d3f-4a5b-9c7d-0e2f4a6b8c1d"
}

سرور MCP همین کار را با ابزار apply انجام می دهد.