# Példák

> Valódi REST-hívások az LW Site Managerrel: állapotfelmérés, bejegyzéslista, frissítések, bővítmények, rendelések, mentés és új bejegyzés.

A válaszok egy tesztoldalról valók. Az író hívásoknál a válasz alakját mutatjuk.

## Állapotfelmérés

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/health-check/run"
```

```json title="Válasz (rövidítve)"
{
  "status": "recommended",
  "score": 79,
  "issues": [
    { "type": "warning", "message": "3 theme update(s) available", "category": "updates" },
    { "type": "warning", "message": "Site is not using HTTPS", "category": "security" }
  ],
  "php_version": "8.3.28",
  "wp_version": "7.1.3",
  "memory": { "limit": "128 MB", "usage": "20 MB", "percent": 15.63 }
}
```

A `status` lehet `good`, `recommended`, `should_be_improved` vagy `critical`. A teljes válasz a tárhely-használatot, a szerver gépnevét és a fájlrendszer-útvonalakat is tartalmazza, ezért csak megbízható kliensnek add ki. Az `include_debug: true` bővebb adatot ad.

## Bejegyzések listája

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" -G "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/list-posts/run" \
  --data-urlencode "input[limit]=2"
```

```json title="Válasz"
{
  "posts": [
    { "id": 24, "title": "Őszi kollekció 2026", "slug": "oszi-kollekcio-2026", "status": "publish", "type": "post",
      "date": "2026-10-28 18:08:22", "modified": "2026-10-28 18:08:22", "author": 0, "featured_image_id": null },
    { "id": 25, "title": "Ajándékötletek karácsonyra", "slug": "ajandekotletek-karacsonyra", "status": "publish", "type": "post",
      "date": "2026-10-28 18:08:22", "modified": "2026-10-28 18:08:22", "author": 0, "featured_image_id": null }
  ],
  "total": 3, "total_pages": 2, "limit": 2, "offset": 0, "has_more": true
}
```

## Frissítések ellenőrzése

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/check-updates/run"
```

```json title="Válasz"
{ "core": { "current": "7.1.3", "available": "7.1.3", "has_update": false },
  "plugins": [],
  "themes": [
    { "slug": "twentytwentyfive", "name": "Twenty Twenty-Five", "current": "1.3", "available": "1.5" },
    { "slug": "twentytwentyfour", "name": "Twenty Twenty-Four", "current": "1.3", "available": "1.6" },
    { "slug": "twentytwentythree", "name": "Twenty Twenty-Three", "current": "1.6", "available": "1.7" } ],
  "total_updates": 3 }
```

## Bővítmények

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/list-plugins/run"
```

```json title="Válasz (13 elemből kettő)"
{ "plugins": [
    { "slug": "lw-site-manager/lw-site-manager.php", "name": "LW Site Manager", "version": "1.6.0", "author": "LW Plugins",
      "description": "Lightweight site manager — full site maintenance via AI/REST using Abilities API.", "active": true },
    { "slug": "woocommerce/woocommerce.php", "name": "WooCommerce", "version": "11.2.1", "author": "Automattic",
      "description": "An ecommerce toolkit that helps you sell anything. Beautifully.", "active": true } ],
  "total": 13, "active_count": 13, "inactive_count": 0 }
```

## Rendelések összesítése

A státuszok címkéi a WooCommerce saját magyar fordításai.

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/wc-orders-totals/run"
```

```json title="Válasz"
{ "success": true,
  "totals": [
    { "status": "pending", "label": "Fizetés függőben", "count": 0 },
    { "status": "processing", "label": "Feldolgozás alatt", "count": 0 },
    { "status": "on-hold", "label": "Fizetés folyamatban", "count": 0 },
    { "status": "completed", "label": "Teljesítve", "count": 0 },
    { "status": "cancelled", "label": "Visszamondva", "count": 0 },
    { "status": "refunded", "label": "Visszatérítve", "count": 0 },
    { "status": "failed", "label": "Sikertelen", "count": 0 },
    { "status": "checkout-draft", "label": "Vázlat", "count": 0 } ],
  "grand_total": 0 }
```

## Új bejegyzés

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" -X POST -H "Content-Type: application/json" \
  -d '{"input":{"title":"Hello","content":"<p>Szia</p>","status":"draft","categories":[5],"tags":["hirek"]}}' \
  "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/create-post/run"
```

```json title="Válasz (alak)"
{ "success": true, "message": "Post created successfully", "post": { "…": "…" }, "id": 123 }
```

## Bejegyzés kukába

Romboló és idempotens, ezért DELETE. Végleges törléshez add hozzá: `input[force]=true`.

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" -X DELETE -G --data-urlencode "input[id]=123" \
  "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/delete-post/run"
```

## Mentés indítása és állapota

A mentés a háttérben, WP-Cronnal készül. Indítás után az állapotát a `backup-status` mutatja.

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" -X POST -H "Content-Type: application/json" \
  -d '{"input":{"include_database":true,"include_files":true}}' \
  "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/create-backup/run"
```

```json title="Válasz (alak)"
{ "success": true, "message": "Backup job started", "backup_id": "2026-10-28_10-00-00_ab12cd34", "status": "pending" }
```

```bash title="Terminál"
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" -G \
  --data-urlencode "input[backup_id]=2026-10-28_10-00-00_ab12cd34" \
  "https://pelda.hu/wp-json/wp-abilities/v1/abilities/site-manager/backup-status/run"
```

Üres oldalon a `list-backups` válasza: `{ "backups": [], "total": 0 }`.
