Chilkat Online Tools

DataFlex / Twitter API v2 / Full-archive Tweet counts

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "query" "" To iSuccess

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://api.twitter.com/2/tweets/counts/all" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1
    Send Destroy of hoResp


End_Procedure

Curl Command

curl -G -d "query="
	-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/tweets/counts/all

Postman Collection Item JSON

{
  "name": "Full-archive Tweet counts",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.twitter.com/2/tweets/counts/all?query=",
      "protocol": "https",
      "host": [
        "api",
        "twitter",
        "com"
      ],
      "path": [
        "2",
        "tweets",
        "counts",
        "all"
      ],
      "query": [
        {
          "key": "query",
          "value": "",
          "description": "Required. Query for matching Tweets. Up to 1024 characters."
        },
        {
          "key": "start_time",
          "value": "",
          "description": "The oldest UTC timestamp from which the Tweets will be provided. YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339).",
          "disabled": true
        },
        {
          "key": "end_time",
          "value": "",
          "description": "The newest, most recent UTC timestamp to which the Tweets will be provided. YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339).",
          "disabled": true
        },
        {
          "key": "since_id",
          "value": "",
          "description": "Returns results with a Tweet ID greater than (that is, more recent than) the specified ID. The ID specified is exclusive and responses will not include it.",
          "disabled": true
        },
        {
          "key": "until_id",
          "value": "",
          "description": "Returns results with a Tweet ID less than (that is, older than) the specified ID. The ID specified is exclusive and responses will not include it.",
          "disabled": true
        },
        {
          "key": "next_token",
          "value": "",
          "description": "This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.",
          "disabled": true
        },
        {
          "key": "granularity",
          "value": null,
          "description": "This is the granularity that you want the timeseries count data to be grouped by. Possible values are day, hour or minute. The default granularity, if not specified is hour.",
          "disabled": true
        }
      ]
    },
    "description": "Search across the complete history of public Tweets matching a search query; since the first Tweet was created in March 2006.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-all) for this endpoint.\n\n**NOTE** this endpoint requires access via the Academic Research product track\n\n[Sign up](https://t.co/signup) for the Twitter API"
  },
  "response": [
  ]
}