# Segment Export

## Find Segment

## Obtains the customers of a previously scheduled segment

<mark style="color:blue;">`GET`</mark> `https://api.woowup.com/apiv3/export/segments/{id}`

Use last\_update attribute to check if segment was updated

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Basic {{API-KEY}} |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json  |
| Accept<mark style="color:red;">\*</mark>        | String | application/json  |

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

```json
{
    "payload": {
        "segment": {
            "id": 1,
            "title": "test",
            "url": "https://example.com",
            "last_update": "YYYY-MM-DD HH:mm:ss"
        }
    },
    "message": "",
    "code": "ok",
    "time": "1ms"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{
    "payload": [],
    "message": "The segment does not exist | The segment is not available for download at this time, please try again in 24 hours.",
    "code": "not_found",
    "time": "45ms"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    "payload": [],
    "message": "parameters required",
    "code": "client_error",
    "time": "45ms"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```json
{
    "payload": [],
    "message": "something happened",
    "code": "server_error",
    "time": "45ms"
}
```

{% endtab %}
{% endtabs %}

## Schedule Segment

## The export will be updated daily with clients who meet the conditions of the segment

<mark style="color:green;">`POST`</mark> `https://api.woowup.com/apiv3/export/segments/{id}`

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | String | Basic {{API-KEY}} |
| Content-Type  | String | application/json  |
| Accept        | String | application/json  |

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

```json
{
    "payload": [],
    "message": "Scheduled segment, in 24 hs the segment is going to be ready to export",
    "code": "ok",
    "time": "17ms"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    "payload": [],
    "message": "Export already scheduled",
    "code": "client_error",
    "time": "19ms"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```json
{
    "payload": [],
    "message": "something happened",
    "code": "server_error",
    "time": "45ms"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{
    "payload": [],
    "message": "The segment does not exist",
    "code": "not_found",
    "time": "13ms"
}
```

{% endtab %}
{% endtabs %}

## Unschedule Segment

## The export will stop updating and will no longer be available

<mark style="color:red;">`DELETE`</mark> `https://api.woowup.com/apiv3/export/segments/{id}`

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | String | Basic {{API-KEY}} |
| Content-Type  | String | application/json  |
| Accept        | String | application/json  |

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

```json
{
    "payload": [],
    "message": "Unscheduled segment",
    "code": "ok",
    "time": "21ms"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```json
{
    "payload": [],
    "message": "something happened",
    "code": "server_error",
    "time": "45ms"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```json
{
    "payload": [],
    "message": "The segment does not exist",
    "code": "not_found",
    "time": "13ms"
}
```

{% endtab %}
{% endtabs %}
