> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Samples-API

## Samples auflisten

Endpunkte \[`GET`]:

| Endpunkt                                 | Beschreibung                        |
| ---------------------------------------- | ----------------------------------- |
| `/api/[app_id]/samples.json`             | Gibt **ALLE** Sample-Typen zurück   |
| `/api/[app_id]/samples/performance.json` | Gibt **Performance**-Samples zurück |
| `/api/[app_id]/samples/errors.json`      | Gibt **Error**-Samples zurück       |

Parameter:

| Param       | Typ               |                                          Beschreibung |
| ----------- | ----------------- | ----------------------------------------------------: |
| action\_id  | string            |             Beispiel: `BlogPostsController-hash-show` |
| exception   | string            |                               Beispiel: NoMethodError |
| since       | timestamp/integer |                               Alle Zeiten sind in UTC |
| before      | timestamp/integer |                               Alle Zeiten sind in UTC |
| limit       | integer           | Die Anzahl der zurückgegebenen Einträge (Standard 10) |
| count\_only | boolean           |               (true/false) Nur die Anzahl zurückgeben |

Maskieren Sie Actions, indem Sie Folgendes ersetzen:

* `#` durch `-hash-`
* `/` durch `-slash-`
* `.` durch `-dot-`

So wird aus `BlogPostsController#show`: `BlogPostsController-hash-show`

Ein Beispiel für eine vollständige Anfrage wäre:

```shell Shell theme={null}
https://appsignal.com/api/5114f7e38c5ce90000000011/samples.json?token=HseUe&action_id=AccountsController-hash-index&exception=ActionView::Template::Error&since=1374843246
```

### Ergebnis

Dieser Endpunkt gibt das folgende JSON zurück (ein Slow-Sample und ein Error-Sample):

<CodeGroup>
  ```json JSON theme={null}
  {
    "count": 2,
    "log_entries": [
      {
        "id": "51f29e7b183d700800150358_SlowController#show_1476962400",
        "action": "SlowController#show",
        "path": "/slow-request",
        "duration": 3182.545407,
        "status": 200,
        "time": 1476962400,
        "is_exception": false,
        "exception": {
          "name": null
        }
      },
      {
        "id": "57f653fa16b7e24cb0dc9e2b_ErrorController#trigger_1475761080",
        "action": "ErrorController#trigger",
        "path": "/error-request",
        "duration": null,
        "status": null,
        "time": 1475761080,
        "is_exception": true,
        "exception": {
          "name": "ActionView::Template::Error"
        }
      }
    ]
  }
  ```
</CodeGroup>

## Sample anzeigen

Endpunkt \[`GET`]: `/api/[app_id]/samples/[id].json`

Parameter:

| Param | Typ    |                                                                                    Beschreibung |
| ----- | ------ | ----------------------------------------------------------------------------------------------: |
| id    | string | Bereinigte Sample-ID (Beispiel: `51f29e7b183d700800150358_SlowController-hash-show_1476962400`) |

### Ergebnis

Dies ist ein **SLOW**-Logeintrag:

<CodeGroup>
  ```json JSON theme={null}
  {
    "id": "51f29e7b183d700800150358_SlowController#show_1476962400",
    "action": "slow#request",
    "db_runtime": 500.0,
    "duration": 300.0,
    "environment": {},
    "hostname": "app1",
    "is_exception": null,
    "kind": "http_request",
    "params": {},
    "path": "/blog",
    "request_format": "html",
    "request_method": "GET",
    "session_data": {},
    "status": "200",
    "view_runtime": 500.0,
    "time": 1002700800,
    "end": 978339601,
    "allocation_count": 110101,
    "events": [
        {
            "action": "query",
            "duration": 250.0,
            "group": "mongoid",
            "name": "query.mongoid",
            "payload": {
                "query": "this is a mongoid query"
            },
            "time": 0,
            "end": 0
            "digest": 00000,
            "allocation_count": 1010101

        }
    ],
    "exception": null
  }
  ```
</CodeGroup>

Dies ist ein **ERROR**-Logeintrag:

<CodeGroup>
  ```json JSON theme={null}
  {
    "id": "57f653fa16b7e24cb0dc9e2b_ErrorController#trigger_1475761080",
    "action": "Error#trigger",
    "db_runtime": 500.0,
    "duration": null,
    "environment": {
      "HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh"
    },
    "hostname": "app1",
    "is_exception": true,
    "kind": "http_request",
    "params": {
      "id": 1,
      "get": "something"
    },
    "path": "/blog",
    "request_format": "html",
    "request_method": "GET",
    "session_data": {
      "current_user_id": 1
    },
    "status": "200",
    "view_runtime": 500.0,
    "time": 1002700800,
    "end": 978339601,
    "events": [],
    "tags": {
      "user": "john doe",
      "id": 1
    },
    "exception": {
      "message": "The method was not found",
      "name": "NoMethodError",
      "backtrace": ["Backtrace line 1", "Backtrace line 2", "Backtrace line 3"]
    }
  }
  ```
</CodeGroup>

**Hinweis:** Wenn Sie erweiterte Abfragen benötigen, z. B. das Suchen von Samples nach Tag, können Sie dies mit unserer [GraphQL-API](https://docs.appsignal.com/api/graphql) tun. Schauen Sie sich die GraphQL-API-Dokumentation für Abfragebeispiele und weitere Details an.
