# Rewards

## Get page rewards

<mark style="color:blue;">`GET`</mark> `https://api.petje.af/v1/page/:pageId/rewards`

This endpoint allows you to get the rewards that belongs to the selected page.\
\
Scope: `pages.read`

#### Path Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| pageId | string | The page ID |

#### Query Parameters

| Name   | Type    | Description                                         |
| ------ | ------- | --------------------------------------------------- |
| planId | string  | Filter the results by this Plan ID                  |
| limit  | integer | The number of rewards to return                     |
| from   | boolean | Offset the results to after the reward with this ID |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Access token using the `Bearer` method |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "count": 3,
    "_embedded": {
        "rewards": [
            {
                "resource": "rewards",
                "id": "6JGhzAiPD7jqlbYkdrg8",
                "name": "Dit is een beloning",
                "description": "Hallo daar!",
                "type": "default",
                "status": "enabled",
                "_links": {
                    "self": {
                        "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB/rewards/6JGhzAiPD7jqlbYkdrg8",
                        "type": "application/hal+json"
                    },
                    "page": {
                        "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB",
                        "type": "application/hal+json"
                    },
                    "plans": {
                        "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB/plans?rewardId=6JGhzAiPD7jqlbYkdrg8",
                        "type": "application/hal+json"
                    }
                }
            },
            ...
        ]
    },
    "_links": {
        "self": {
            "href": "https://api.petje.af/rewards",
            "type": "application/hal+json"
        },
        "next": null
    }
}
```

{% endtab %}
{% endtabs %}

## Get page reward detail

<mark style="color:blue;">`GET`</mark> `https://api.petje.af/v1/pages/:pageId/rewards/:id`

Scope: `pages.read`

#### Path Parameters

| Name   | Type   | Description   |
| ------ | ------ | ------------- |
| pageId | string | The page ID   |
| id     | string | The reward ID |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | Access token using the `Bearer` method |

{% tabs %}
{% tab title="200 " %}

```
{
    "resource": "rewards",
    "id": "6JGhzAiPD7jqlbYkdrg8",
    "name": "Dit is een beloning",
    "description": "Hall daar!",
    "type": "default",
    "status": "enabled",
    "_links": {
        "self": {
            "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB/rewards/6JGhzAiPD7jqlbYkdrg8",
            "type": "application/hal+json"
        },
        "page": {
            "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB",
            "type": "application/hal+json"
        },
        "plans": {
            "href": "https://api.petje.af/pages/5SaEUOWD2b4dN7tJBKMB/plans?rewardId=6JGhzAiPD7jqlbYkdrg8",
            "type": "application/hal+json"
        }
    }
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "status": 404,
    "title": "Not Found",
    "detail": "Page Reward is not found",
    "_links": {
        "documentation": {
            "href": "https://docs.petje.af",
            "type": "text/html"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petje.af/petje.af-api/reference/rewards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
