# Nyilvános teljesítményadatok lekérése

Kanonikus URL: https://sosoapi.ai/hu/docs/api/analytics-api-public-performance-read

Szerződés: sha256:6a53c6b98f970cf0

A munkaterülethez kapcsolt fiók nem hivatalos, nyilvános X-számlálóinak lekérése. A hiányzó számlálók nem elérhetők maradnak; a fizetős X API és hitelesítő adatok nem kerülnek felhasználásra.

POST /analytics-api/public-performance/read

## Hitelesítés és engedélyek

- **Elfogadott hitelesítőadat-osztályok:** user_session, delegated_oauth, personal_access_token

- **Delegált képesség:** agent:operate

- **Minimális munkaterületi szerepkör:** viewer

- **Hozzáférési hatókör:** A felhasználó számára engedélyezett erőforrások

- **Minden munkaterületre kiterjedő hozzájárulás szükséges:** Nem

- **Állapotot módosít:** Nem

- **A művelet befejezésekor:** Kifejezetten nem hivatalos nyilvános számlálók vagy az elérhetetlenség bizonyítéka; soha nem hivatalos Insights

A token csak a tulajdonosa jogait használhatja. Minden kérés ellenőrzi a munkaterületi tagságot, erőforrás-tulajdonjogot, kiválasztott munkaterületeket és megadott képességeket. A core és full profil a megjelenített eszközöket változtatja; hozzáférést nem ad.

## Kérésmezők

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "social_account_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "cursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    },
    "refresh": {
      "type": "boolean"
    }
  },
  "required": [
    "workspace_id",
    "social_account_id"
  ],
  "additionalProperties": false
}
```

## Válasz és befejezés

Sikeres HTTP-állapotok: 200

A sikeres HTTP-válasz jelentheti a kérés elfogadását, nem a befejezését. Háttérmunkánál mentsd a visszakapott azonosítót, és ugyanazt a műveletet ellenőrizd a befejezésig. Az időzített vagy elfogadott bejegyzés csak platformmegerősítés után közzétett; a kliens időtúllépése nem igazolja az eredményt.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract_version": {
      "type": "string",
      "const": "public-performance/v1"
    },
    "source": {
      "type": "string",
      "const": "fxtwitter"
    },
    "source_kind": {
      "type": "string",
      "const": "unofficial_public"
    },
    "platform": {
      "type": "string",
      "const": "x"
    },
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "social_account_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "provider_account_id": {
      "type": "string",
      "pattern": "^\\d{2,20}$"
    },
    "fetched_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "upstream_updated_at": {
      "type": "null"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "cache_status": {
      "type": "string",
      "enum": [
        "hit",
        "stored",
        "bypassed"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "available",
        "partial",
        "unavailable"
      ]
    },
    "profile": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "maxLength": 200
            },
            "handle": {
              "type": "string",
              "maxLength": 100
            },
            "followers": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "name",
            "handle",
            "followers"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "posts": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^\\d{2,20}$"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "text": {
            "type": "string",
            "maxLength": 30000
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "post",
              "reply"
            ]
          },
          "media_kind": {
            "type": "string",
            "enum": [
              "text",
              "image",
              "video"
            ]
          },
          "metrics": {
            "type": "object",
            "properties": {
              "views": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "likes": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "replies": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reposts": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "quotes": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bookmarks": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "views",
              "likes",
              "replies",
              "reposts",
              "quotes",
              "bookmarks"
            ]
          }
        },
        "required": [
          "id",
          "url",
          "text",
          "published_at",
          "kind",
          "media_kind",
          "metrics"
        ]
      }
    },
    "coverage": {
      "type": "object",
      "properties": {
        "complete": {
          "type": "boolean"
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "views_available_posts": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "omitted_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "reasons": {
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 300
          }
        }
      },
      "required": [
        "complete",
        "next_cursor",
        "views_available_posts",
        "omitted_rows",
        "reasons"
      ]
    }
  },
  "required": [
    "contract_version",
    "source",
    "source_kind",
    "platform",
    "workspace_id",
    "social_account_id",
    "provider_account_id",
    "fetched_at",
    "upstream_updated_at",
    "expires_at",
    "cache_status",
    "status",
    "profile",
    "posts",
    "coverage"
  ]
}
```

## Hibák és biztonságos újrapróbálás

Ellenőrizd a HTTP-állapotot és a válasz törzsét. A 400 ellenőrzési hiba ZodError értéket tartalmazhat; a kezelőhibák az error, message és code mezőket használják. Őrizd meg a request_id vagy x-request-id értéket a diagnózishoz, hitelesítő adatok nélkül. Újrapróbálás előtt javítsd a 401/403 hozzáférési hibákat; 429 esetén kövesd a Retry-After értékét. Bizonytalan írás vagy 5xx válasz esetén előbb olvasd el a meglévő eredményt. Csak támogatott műveletnél használj újra idempotenciakulcsot; az újrapróbálás műveletenként eltér, és nem garantál pontosan egyszeri kézbesítést.

## Példák

A példák sémákkal ellenőrzött képzeletbeli értékeket használnak. Az azonosítókat engedélyezettekre, a médiát kész tartalomelemekre, a dátumokat megerősített közzétételi időpontra cseréld. Írás beküldése előtt ellenőrizd a fiók jogosultságát. Ez az oldal nem küld API-kérést.

A szervereden állítsd a SOSOAPI_ACCESS_TOKEN értékét a művelet által elfogadott hitelesítő adatra, és tartsd távol a böngészőkódtól. Ügynökhöz a sosoapi auth login paranccsal jelentkezz be böngészőben, és hagyd, hogy a CLI frissítse a hitelesítő adatokat.

request.json

```json
{
  "workspace_id": "11111111-1111-4111-8111-111111111111",
  "social_account_id": "22222222-2222-4222-8222-222222222222"
}
```

cURL

```bash
curl --request POST \
  "https://gqeshlawtcexsapabaui.supabase.co/functions/v1/analytics-api/public-performance/read" \
  -H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @request.json
```

JavaScript

```js
// Server-side JavaScript. Do not print tokens or credential-bearing responses.
const token = process.env.SOSOAPI_ACCESS_TOKEN;
if (!token) throw new Error("Set an accepted credential for this operation");
const response = await fetch("https://gqeshlawtcexsapabaui.supabase.co/functions/v1/analytics-api/public-performance/read", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
  body: JSON.stringify({
  "workspace_id": "11111111-1111-4111-8111-111111111111",
  "social_account_id": "22222222-2222-4222-8222-222222222222"
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.
```

CLI

```bash
npx sosoapi api post /analytics-api/public-performance/read < request.json
```

Szintetikus válaszpélda

```json
{
  "workspace_id": "11111111-1111-4111-8111-111111111111",
  "social_account_id": "22222222-2222-4222-8222-222222222222",
  "contract_version": "public-performance/v1",
  "source": "fxtwitter",
  "source_kind": "unofficial_public",
  "platform": "x",
  "provider_account_id": "12345",
  "fetched_at": "2099-01-15T09:00:00Z",
  "upstream_updated_at": null,
  "expires_at": "2099-01-15T09:05:00Z",
  "cache_status": "stored",
  "status": "unavailable",
  "profile": null,
  "posts": [],
  "coverage": {
    "complete": false,
    "next_cursor": null,
    "views_available_posts": 0,
    "omitted_rows": 0,
    "reasons": [
      "Fictional public source unavailable; no account data was read."
    ]
  }
}
```

## Kapcsolódó eszközök és útmutatók

MCP: sosoapi_read_public_performance

[API-referencia](https://sosoapi.ai/hu/docs/api)
