# Benefits

## Benefits

### GET /benefits

Retrieve a list of benefits separated by status

| Parameter          | Type  | Required | Description                                      |
| ------------------ | ----- | -------- | ------------------------------------------------ |
| currentbenefits    | query | No       | Amount of benefits available for redeem returned |
| outofstockbenefits | query | No       | Amount of benefits out of stock returned         |
| comingbenefits     | query | No       | Amount of coming benefits returned               |

#### Example <a href="#example" id="example"></a>

```bash
curl -X GET \
  'https://api.woowup.com/apiv3/benefits?outofstockbenefits=1000&comingbenefits=1000&currentbenefits=1000' \
  -H 'accept: application/json' \
  -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -H 'cache-control: no-cache'
```

#### Response <a href="#response" id="response"></a>

```bash
{
  "payload": {
    "current": [
      {
        "id": 123,
        "slug": "benefit-1-title",
        "title": "Benefit 1 title",
        "description": "Benefit 1 description",
        "status": "1",
        "image_id": "1234",
        "user_id": "1234",
        "app_id": "123",
        "app_code": "CONTEST",
        "contenttype_id": "10",
        "version": null,
        "category_id": null,
        "startdate": "2017-03-24 00:00:00",
        "enddate": "2017-12-31 09:30:26",
        "featured": "0",
        "wallpublish": "0",
        "monthly_redeems": "3",
        "modified": "2017-03-21 19:37:25",
        "created": "2017-02-22 18:49:17",
        "image_url": "https://api.woowup.com/uploads/1234567/qwerty-adfg-zcv-iuytr-vbnmjhgfd.png",
        "points": 0,
        "event_date": "2017-06-02 18:00:00",
        "sku": "s000123"
      }
    ],
    "outofstock": [
      {
        "id": 124,
        "slug": "benefit-2-title",
        "title": "Benefit 2 title",
        "description": "Benefit 2 description",
        "status": "1",
        "image_id": "1234",
        "user_id": "1234",
        "app_id": "123",
        "app_code": "CONTEST",
        "contenttype_id": "10",
        "version": null,
        "category_id": null,
        "startdate": "2017-03-24 00:00:00",
        "enddate": "2017-12-31 09:30:26",
        "featured": "0",
        "wallpublish": "0",
        "monthly_redeems": "3",
        "modified": "2017-03-21 19:37:25",
        "created": "2017-02-22 18:49:17",
        "image_url": "https://api.woowup.com/uploads/1234567/qwerty-adfg-zcv-iuytr-vbnmjhgfd.png",
        "points": 0,
        "event_date": "2017-06-02 18:00:00",
        "sku": "s000124"
      }
    ],
    "comingbenefits": [
      {
        "id": 125,
        "slug": "benefit-3-title",
        "title": "Beneift 3 title",
        "description": "Benefit 3 description",
        "status": "1",
        "image_id": "1234",
        "user_id": "1234",
        "app_id": "123",
        "app_code": "CONTEST",
        "contenttype_id": "10",
        "version": null,
        "category_id": null,
        "startdate": "2017-03-24 00:00:00",
        "enddate": "2017-12-31 09:30:26",
        "featured": "0",
        "wallpublish": "0",
        "monthly_redeems": "3",
        "modified": "2017-03-21 19:37:25",
        "created": "2017-02-22 18:49:17",
        "image_url": "https://api.woowup.com/uploads/1234567/qwerty-adfg-zcv-iuytr-vbnmjhgfd.png",
        "points": 0,
        "event_date": "2017-06-02 18:00:00",
        "sku": "s000125"
      }
    ]
  },
  "message": "",
  "code": "ok",
  "time": "36ms"
}
```

#### HTTP Response codes <a href="#http-response-codes" id="http-response-codes"></a>

| HTTP Code | Name               | Description                                    |
| --------- | ------------------ | ---------------------------------------------- |
| 200       | ok                 | Successful request                             |
| 400       | bad request        | Invalid parameters                             |
| 403       | forbidden          | Invalid or inexistent apikey                   |
| 405       | method not allowed | Use an invalid http verb in the request        |
| 500       | server error       | Internal error, explained in the json response |

### GET /benefits/all

Retrieve a list of ALL benefits.

| Parameter | Type  | Required | Description                                        |
| --------- | ----- | -------- | -------------------------------------------------- |
| page      | query | No       | Page number. Default: 0                            |
| limit     | query | No       | Amount of benefits per page. Default: 25, Max: 100 |

#### Example <a href="#example-1" id="example-1"></a>

```bash
curl -X GET \
  'https://api.woowup.com/apiv3/benefits?page=0&limit=100' \
  -H 'accept: application/json' \
  -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -H 'cache-control: no-cache'
```

#### Response <a href="#response-1" id="response-1"></a>

```javascript
{
    "payload": [{
        "id": "1",
        "slug": "beneficio-1",
        "title": "Beneficio 1",
        "description": "Descripción del beneficio 1",
        "status": "1",
        "image_id": "2",
        "user_id": "3",
        "app_id": "4",
        "app_code": "CONTEST",
        "contenttype_id": "10",
        "version": null,
        "category_id": null,
        "startdate": "2018-03-25 21:11:00",
        "enddate": "2018-12-31 09:30:26",
        "featured": "0",
        "wallpublish": "0",
        "monthly_redeems": "1",
        "modified": "2018-03-20 17:12:04",
        "created": "2018-03-20 17:12:04",
        "image_url": "https://admin.woowup.com/uploads/123/123-asd-asd-asd-asd.png",
        "points": 0,
        "event_date": "2018-03-27 12:00:00",
        "out_stock_at": null,
        "sku": "s000001"
    }, {
        "id": "2",
        "slug": "beneficio-2",
        "title": "Título del beneficio 2",
        "description": "Descripción del beneficio 2",
        "status": "1",
        "image_id": "2",
        "user_id": "3",
        "app_id": "4",
        "app_code": "CONTEST",
        "contenttype_id": "10",
        "version": null,
        "category_id": null,
        "startdate": "2018-03-22 20:28:00",
        "enddate": "2018-12-31 09:30:26",
        "featured": "1",
        "wallpublish": "0",
        "monthly_redeems": "1",
        "modified": "2018-03-20 17:25:43",
        "created": "2018-03-19 11:32:28",
        "image_url": "https://admin.woowup.com/uploads/123/asd-qwe-qwe-asd-xcv.jpg",
        "points": 0,
        "event_date": "2018-03-25 22:00:00",
        "out_stock_at": null,
        "sku": "s000002"
    }],
    "message": "",
    "code": "ok",
    "time": "36ms"
}
```

#### HTTP Response codes <a href="#http-response-codes-1" id="http-response-codes-1"></a>

| HTTP Code | Name               | Description                                    |
| --------- | ------------------ | ---------------------------------------------- |
| 200       | ok                 | Successful request                             |
| 400       | bad request        | Invalid parameters                             |
| 403       | forbidden          | Invalid or inexistent apikey                   |
| 405       | method not allowed | Use an invalid http verb in the request        |
| 500       | server error       | Internal error, explained in the json response |

### POST /benefits/{benefit\_id}/assign

Assign a benefit to a customer

| Parameter   | Type | Required | Description |
| ----------- | ---- | -------- | ----------- |
| benefit\_id | Url  | Yes      | Benefit ID  |
| userapp\_id | POST | Yes      | Customer ID |

#### Example

```bash
curl -X POST \
  'https://api.woowup.com/apiv3/benefits/123/assign' \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -H 'Cache-Control: no-cache'
  -H 'Content-Type: application/x-www-form-urlencoded'
  -d 'userapp_id=456'
```

This example assign benfit with **ID 123** to customer with **ID 456**

#### **Response**

```bash
{
    "payload": {
        "status": true
    },
    "message": "ok",
    "code": "ok",
    "time": "123ms"
}
```

#### HTTP Response codes <a href="#http-response-codes-1" id="http-response-codes-1"></a>

| HTTP Code | Name               | Description                                    |
| --------- | ------------------ | ---------------------------------------------- |
| 200       | ok                 | Successful request                             |
| 400       | bad request        | Invalid parameters                             |
| 403       | forbidden          | Invalid or inexistent apikey                   |
| 405       | method not allowed | Use an invalid http verb in the request        |
| 500       | server error       | Internal error, explained in the json response |


---

# 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://woowup-docs.gitbook.io/woowup-developer-docs/api/benefits.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.
