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

# हाल के पोस्ट की संख्या

> पिछले 7 दिनों के पोस्ट की संख्या प्राप्त करें

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

यह गाइड आपको पिछले 7 दिनों के पोस्ट की संख्या (वॉल्यूम) प्राप्त करने का तरीका बताती है।

<Note>
  **पूर्वापेक्षाएँ**

  शुरू करने से पहले, आपके पास ये होने चाहिए:

  * स्वीकृत ऐप के साथ एक [डेवलपर खाता](https://developer.x.com/en/portal/petition/essential/basic-info)
  * आपके ऐप का बेयरर टोकन
</Note>

***

<div id="get-recent-post-counts">
  ## हाल के पोस्ट की संख्या प्राप्त करें
</div>

<Steps>
  <Step title="एक क्वेरी बनाएँ">
    हाल की खोज वाला ही क्वेरी सिंटैक्स इस्तेमाल करें। उदाहरण के लिए, @XDevelopers के पोस्ट की संख्या गिनने के लिए:

    ```
    from:XDevelopers
    ```
  </Step>

  <Step title="अनुरोध भेजें">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/tweets/counts/recent?\
      query=from%3AXDevelopers&\
      granularity=day" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # हाल के पोस्ट्स की संख्या प्राप्त करें
      response = client.posts.count_recent(
          query="from:XDevelopers",
          granularity="day"
      )

      for bucket in response.data:
          print(f"{bucket.start}: {bucket.tweet_count} Posts")

      print(f"Total: {response.meta.total_tweet_count}")
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      // हाल के पोस्ट्स की संख्या प्राप्त करें
      const response = await client.posts.countRecent({
        query: "from:XDevelopers",
        granularity: "day",
      });

      response.data?.forEach((bucket) => {
        console.log(`${bucket.start}: ${bucket.tweet_count} Posts`);
      });

      console.log(`Total: ${response.meta?.total_tweet_count}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="प्रतिक्रिया की समीक्षा करें">
    ```json theme={null}
    {
      "data": [
        {
          "end": "2024-01-16T00:00:00.000Z",
          "start": "2024-01-15T00:00:00.000Z",
          "tweet_count": 5
        },
        {
          "end": "2024-01-17T00:00:00.000Z",
          "start": "2024-01-16T00:00:00.000Z",
          "tweet_count": 3
        },
        {
          "end": "2024-01-18T00:00:00.000Z",
          "start": "2024-01-17T00:00:00.000Z",
          "tweet_count": 8
        }
      ],
      "meta": {
        "total_tweet_count": 16
      }
    }
    ```
  </Step>
</Steps>

***

<div id="granularity-options">
  ## ग्रैन्युलैरिटी विकल्प
</div>

यह नियंत्रिت करें कि गणनाओं को कैसे समूहित किया जाए:

| ग्रैन्युलैरिटी | विवरण                         |
| :------------- | :---------------------------- |
| `minute`       | प्रति मिनट की गणना            |
| `hour`         | प्रति घंटे की गणना (डिफ़ॉल्ट) |
| `day`          | प्रति दिन की गणना             |

<CodeGroup dropdown>
  ```bash cURL theme={null}
  # प्रति घंटे की गणना प्राप्त करें
  curl "https://api.x.com/2/tweets/counts/recent?\
  query=python%20lang%3Aen&\
  granularity=hour" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # प्रति घंटे की गणना प्राप्त करें
  response = client.posts.count_recent(
      query="python lang:en",
      granularity="hour"
  )

  for bucket in response.data:
      print(f"{bucket.start}: {bucket.tweet_count}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // प्रति घंटे की गणना प्राप्त करें
  const response = await client.posts.countRecent({
    query: "python lang:en",
    granularity: "hour",
  });

  response.data?.forEach((bucket) => {
    console.log(`${bucket.start}: ${bucket.tweet_count}`);
  });
  ```
</CodeGroup>

***

<div id="filter-by-time-range">
  ## समय सीमा के आधार पर फ़िल्टर करें
</div>

गिनती को किसी विशेष समय अवधि तक सीमित करें:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/tweets/counts/recent?\
  query=from%3AXDevelopers&\
  start_time=2024-01-10T00%3A00%3A00Z&\
  end_time=2024-01-15T00%3A00%3A00Z&\
  granularity=day" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # किसी विशेष समय सीमा के लिए गिनती प्राप्त करें
  response = client.posts.count_recent(
      query="from:XDevelopers",
      start_time="2024-01-10T00:00:00Z",
      end_time="2024-01-15T00:00:00Z",
      granularity="day"
  )

  print(f"Total Posts: {response.meta.total_tweet_count}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // किसी विशेष समय सीमा के लिए गिनती प्राप्त करें
  const response = await client.posts.countRecent({
    query: "from:XDevelopers",
    startTime: "2024-01-10T00:00:00Z",
    endTime: "2024-01-15T00:00:00Z",
    granularity: "day",
  });

  console.log(`Total Posts: ${response.meta?.total_tweet_count}`);
  ```
</CodeGroup>

***

<div id="common-parameters">
  ## सामान्य पैरामीटर
</div>

| पैरामीटर      | विवरण                              | डिफ़ॉल्ट    |
| :------------ | :--------------------------------- | :---------- |
| `query`       | खोज क्वेरी (आवश्यक)                | —           |
| `granularity` | समय बकेट का आकार                   | `hour`      |
| `start_time`  | सबसे पुराना टाइमस्टैम्प (ISO 8601) | 7 दिन पहले  |
| `end_time`    | नवीनतम टाइमस्टैम्प (ISO 8601)      | वर्तमान समय |

***

<div id="next-steps">
  ## अगले चरण
</div>

<CardGroup cols={2}>
  <Card title="पूर्ण-आर्काइव गणनाएँ" icon="vault" href="/hi/x-api/posts/counts/quickstart/full-archive-tweet-counts">
    ऐतिहासिक पोस्ट की संख्या प्राप्त करें
  </Card>

  <Card title="क्वेरी बनाएँ" icon="magnifying-glass" href="/hi/x-api/posts/counts/integrate/build-a-query">
    क्वेरी सिंटैक्स में महारत हासिल करें
  </Card>

  <Card title="API संदर्भ" icon="code" href="/hi/x-api/posts/recent-post-count">
    एंडपॉइंट का पूरा दस्तावेज़ीकरण
  </Card>
</CardGroup>
