# सेगमेंटेशन (फिल्टर्स) API

## createFilter

`POST` `https://api.pushwoosh.com/json/1.3/createFilter`

एक नया फ़िल्टर बनाता है।

**रिक्वेस्ट बॉडी**

| नाम | आवश्यक | प्रकार | विवरण |
| --- | --- | --- | --- |
| auth\* | हाँ | string | Pushwoosh कंट्रोल पैनल से [API एक्सेस टोकन](/hi/developer/api-reference/api-identifiers/#api-access-token)। |
| name\* | हाँ | string | [फ़िल्टर का नाम](/hi/developer/api-reference/api-identifiers/#segment--filter-name)। |
| filter\_expression\* | हाँ | string | <p><a href="/developer/api-reference/segmentation-filters-api/segmentation-language/">सेगमेंटेशन भाषा</a> के नियमों के अनुसार बनाया गया एक्सप्रेशन। <br /><strong>उदाहरण:</strong> <code>T("City", eq, "Madrid")</code> उन उपयोगकर्ताओं को सेगमेंट करने के लिए जिनका शहर मैड्रिड है।</p> |
| application | नहीं | string | [Pushwoosh एप्लिकेशन कोड](/hi/developer/api-reference/api-identifiers/#application-code)। यह पैरामीटर केवल हाई-स्पीड सेटअप के साथ प्रयोग करने योग्य है; अन्यथा इसे छोड़ दें। |
| expiration\_date | नहीं | string | फ़िल्टर की समाप्ति। फ़िल्टर निर्दिष्ट तिथि पर स्वचालित रूप से हटा दिया जाएगा, जब तक कि इसका उपयोग किसी प्रीसेट या RSS फ़ीड में न किया जाए। |

**200**   
```json
{
  "status_code": 200, 
  "status_message": "OK", 
  "response": {
    "name": "filter name"
  }
}
```



**उदाहरण**
```json
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",
    "name": "City = Madrid",
    "filter_expression": "T(\"City\", eq, \"Madrid\")",
    "application": "B18XX-XXXXX",
    "expiration_date": "2025-01-01"
  }
}

// creating Filters for Timezones 
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
    "name": "Timezone Filter",
    "filter_expression": "T(\"Timezone\", BETWEEN, [\"UTC-12:00\", \"UTC+14:00\"])"
  }
}
```


## listFilters

`POST` `https://api.pushwoosh.com/json/1.3/listFilters`

उपलब्ध सेगमेंट (फिल्टर) की सूची उनकी शर्तों के साथ लौटाता है।

**रिक्वेस्ट बॉडी**

| नाम | आवश्यक | प्रकार | विवरण |
| --- | --- | --- | --- |
| auth\* | हाँ | string | Pushwoosh कंट्रोल पैनल से [API एक्सेस टोकन](/hi/developer/api-reference/api-identifiers/#api-access-token)। |
| application\* | हाँ | string | [Pushwoosh एप्लिकेशन कोड](/hi/developer/api-reference/api-identifiers/#application-code) |


**200** 
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "filters": [{
      "code": "52551-F2F42",
      "name": "City = Madrid",
      "filter_expression": "T(\"City\", eq, \"madrid\")",
      "expiration_date": "2025-01-01",
      "application": "B18XX-XXXXX"
    }]
  }
}

```


**उदाहरण**
```json
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",
    "application": "B18XX-XXXXX"
  }
}
```

## deleteFilter

`POST` `https://api.pushwoosh.com/json/1.3/deleteFilter`

एक मौजूदा फ़िल्टर को हटाता है।

**रिक्वेस्ट बॉडी**

| नाम | प्रकार | विवरण |
| --- | --- | --- |
| auth\* | string | Pushwoosh कंट्रोल पैनल से [API एक्सेस टोकन](/hi/developer/api-reference/api-identifiers/#api-access-token)। |
| name\* | string | [फ़िल्टर का नाम](/hi/developer/api-reference/api-identifiers/#segment--filter-name)। |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": null
}
```
</TabItem>
</Tabs>



```json title="उदाहरण"
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H", // API access token from Pushwoosh Control Panel
    "name": "filter name"
  }
}
```

## exportSegment

`POST` `https://api.pushwoosh.com/api/v2/audience/exportSegment`

एक अनुसूचित अनुरोध। निर्दिष्ट फ़िल्टर शर्तों के अंतर्गत आने वाले सब्सक्राइबर्स की सूची निर्यात करता है।

**रिक्वेस्ट बॉडी**
| नाम <div style="width:100px"></div> | आवश्यक <div style="width:100px"></div> | प्रकार | विवरण |
|---|---|---|---|
| auth\* | हाँ | string | Pushwoosh कंट्रोल पैनल से [API एक्सेस टोकन](/hi/developer/api-reference/api-identifiers/#api-access-token)। |
| filterExpression\* | हाँ | string | फ़िल्टर की शर्तें |
| exportData | नहीं | array | निर्यात करने के लिए डेटा। संभावित मान: `"hwids"`, `"push_tokens"`, `"users"`, `"tags"`, `"location"`। `"location"` को शामिल करने से निर्यात की गई CSV में `Latitude` और `Longitude` कॉलम जुड़ जाते हैं। यदि `exportData` को छोड़ दिया जाता है, तो `Latitude` और `Longitude` डिफ़ॉल्ट रूप से निर्यात में शामिल होते हैं। |
| filterCode | नहीं | string | पहले से बना [फ़िल्टर कोड](/hi/developer/api-reference/api-identifiers/#segment--filter-code), `filterExpression` के बजाय इस्तेमाल किया जा सकता है। `/listFilters` API से या कंट्रोल पैनल में फ़िल्टर देखते समय अपने ब्राउज़र के एड्रेस बार से प्राप्त किया जा सकता है। |
| applicationCode | यदि आप `filterExpression` या `filterCode` का उपयोग कर रहे हैं तो आवश्यक है। | string | [Pushwoosh एप्लिकेशन कोड](/hi/developer/api-reference/api-identifiers/#application-code) |
| generateExport | नहीं | boolean | डिफ़ॉल्ट रूप से `true` पर सेट है, और प्रतिक्रिया में फ़ाइल डाउनलोड करने के लिए एक लिंक होता है। यदि false है, तो प्रतिक्रिया में केवल डिवाइस की संख्या भेजी जाएगी। |
| format | नहीं | string | निर्यात की गई फ़ाइल का प्रारूप सेट करता है: "csv" या "json\_each\_line"। यदि छोड़ा गया है, तो CSV फ़ाइल उत्पन्न होती है। |
| tagsList | नहीं | array | निर्यात करने के लिए [टैग](/hi/developer/api-reference/api-identifiers/#tag) निर्दिष्ट करता है। केवल विशिष्ट टैग प्राप्त करने के लिए, "exportData" ऐरे में "tags" मान होना चाहिए। |
| includeWithoutTokens | नहीं | boolean | निर्यात की गई फ़ाइल में बिना पुश टोकन वाले उपयोगकर्ताओं को शामिल करने के लिए `true` पर सेट करें। डिफ़ॉल्ट `false` है। |


<Tabs>
<TabItem label="200 Successful">
```json
{
  "task_id": "177458"
}
```
</TabItem>
</Tabs>



```json title="उदाहरण"
{
  "auth": "yxoPUlwqm…………pIyEX4H",                           // required. API access token from Pushwoosh Control Panel
  "filterExpression": "AT(\"12345-67890\", \"Name\", any)", // filter conditions, refer to the Segmentation Language guide for syntax 
  "filterCode": "12345-67890",                              // pre-made filter code, can be used instead of filterExpression
  "applicationCode": "00000-AAAAA",                         // Required if you're using either `filterExpression` or `filterCode`. Pushwoosh app code. Can be obtained from /listFilters API request or address bar of your browser while viewing the filter in Control Panel.
  "generateExport": true,                                   // if false, devices count only will be sent in response; by default, a response contains a link to download the CSV file
  "format": "json_each_line",                               // format of the file to present the data in: "csv" – the .csv file is downloaded; "json" – a JSON file with all expored devices; or "json_each_line" – JSON line for each device. If not specified, CSV is the default format. 
  "exportData": ["hwids", "tags"],                          // optional. Data to export. Possible values: "hwids", "push_tokens", "users", "tags", "location", "fcm_keys", "web keys"
  "tagsList": ["Name", "Level"],                            // optional. Specifies tags to export. To obtain the specific tags only, the "tags" value should be sent within the "exportData" array or the "exportData" be empty. 
  "includeWithoutTokens": true                              // optional. Set to true to include users without push tokens in the exported file. Default is false.
}
```

<Aside type="note">
फ़िल्टर एक्सप्रेशन लिखने के लिए सेगमेंटेशन भाषा संदर्भ [यहां](/hi/developer/api-reference/segmentation-filters-api/segmentation-language/) पाएं।
</Aside>

उदाहरण के लिए, किसी विशेष ऐप के सभी सब्सक्राइबर्स को निर्यात करने के लिए, निम्नलिखित फ़िल्टर शर्तों का उपयोग करें:

```json
{
  "auth": "yxoPUlwqm…………pIyEX4H",            // API access token from Pushwoosh Control Panel
  "filterExpression": "A(\"AAAAA-BBBBB\")",  // Filter expression referencing app segment
  "applicationCode": "AAAAA-BBBBB"           // Required Pushwoosh app code
}
```

<Aside type="caution">
प्रतिक्रिया में, आपको परिणामी फ़ाइल प्राप्त करने के लिए **`task_id`** मिलेगा। फिर, परिणामी फ़ाइल को पुनः प्राप्त करने के लिए अनुरोध बॉडी में उस `task_id` के साथ [/exportSegment/result](./#exportsegment-results) को कॉल करें।
</Aside>

## exportSegment results

`POST` `https://api.pushwoosh.com/api/v2/audience/exportSegment/result`

**/exportSegment परिणामों के साथ CSV का लिंक पुनः प्राप्त करता है।**

**रिक्वेस्ट बॉडी**

| नाम | प्रकार | विवरण |
| --- | --- | --- |
| auth\* | String | Pushwoosh कंट्रोल पैनल से [API एक्सेस टोकन](/hi/developer/api-reference/api-identifiers/#api-access-token)। |
| task\_id\* | String | आपके `/exportSegment` प्रतिक्रिया में प्राप्त पहचानकर्ता। |

<Tabs>
<TabItem label="200: OK">
```json
{
  "devicesCount": "24735",
  "filename": "https://static.pushwoosh.com/segment-export/export_segment_XXXXX_XXXXX_xxxxxxxxxxxxxxxxx.csv.zip",
  "status": "completed"
}
```
</TabItem>
</Tabs>

अपने `/exportSegment` प्रतिक्रिया में प्राप्त "**task\_id**" को `/exportSegment/result` अनुरोध बॉडी में पास करें।

`/exportSegment/result` प्रतिक्रिया में, आपको "filename" पैरामीटर मिलेगा। उस पैरामीटर मान में दिए गए लिंक का पालन करके एक ZIP संग्रह स्वचालित रूप से डाउनलोड करें।
CSV या JSON फ़ाइल (आपके अनुरोध में निर्दिष्ट "format" के आधार पर) जिसमें डिवाइस का डेटा है, उसे पुनः प्राप्त करने के लिए संग्रह को अनपैक करें।

3 अप्रैल, 2025 से फ़ाइल डाउनलोड करने के लिए प्राधिकरण आवश्यक है:

- यदि **ब्राउज़र** के माध्यम से डाउनलोड कर रहे हैं, तो एक्सेस पाने के लिए बस **Pushwoosh कंट्रोल पैनल** में लॉग इन करें।
- यदि **सर्वर सॉफ़्टवेयर** के माध्यम से डाउनलोड कर रहे हैं, तो अपने अनुरोध में निम्नलिखित हेडर शामिल करें:
`Authorization: Token YOUR_API_TOKEN`

यदि आप अपने `/exportSegment` अनुरोध में "exportData" निर्दिष्ट करते हैं, तो डाउनलोड की गई फ़ाइल में केवल अनुरोधित डेटा होगा। डिफ़ॉल्ट रूप से, फ़ाइल में निम्नलिखित उपयोगकर्ता डेटा होता है:

| **फ़ील्ड** | विवरण | मान का उदाहरण |
| --- | --- | --- |
| Hwid | [डिवाइस की हार्डवेयर आईडी](/hi/developer/api-reference/api-identifiers/#hardware-id) | 01D1BA5C-AAAA-0000-BBBB-9B81CD5823C8 |
| User ID | [यूज़र आईडी](/hi/developer/api-reference/api-identifiers/#user-id) जो किसी डिवाइस को किसी विशेष उपयोगकर्ता के साथ जोड़ता है। यदि कोई यूज़र आईडी निर्दिष्ट नहीं है, तो HWID का उपयोग किया जाता है। | user8192 |
| Push Token | क्लाउड मैसेजिंग गेटवे द्वारा किसी डिवाइस को सौंपा गया अद्वितीय पहचानकर्ता। [और जानें](/hi/developer/api-reference/api-identifiers/#push-token) | eeeb2fd7....0fc3547 |
| Type | प्लेटफ़ॉर्म प्रकार (पूर्णांक)। | 1 |
| Type (humanized) | प्लेटफ़ॉर्म प्रकार (स्ट्रिंग)। | iOS |
| Age | डिफ़ॉल्ट आयु टैग का मान। | 29 |
| ApplicationVersion | डिफ़ॉल्ट एप्लिकेशन संस्करण टैग का मान। | 1.12.0.0 |
| City | डिफ़ॉल्ट शहर टैग का मान। | us, boston |
| TagName | आपके खाते में बनाए गए टैग का मान। | TagValue |