curl --request POST \
--url https://api.x.com/2/tweets/search/stream/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee Posts"
}
]
}
'import requests
url = "https://api.x.com/2/tweets/search/stream/rules"
payload = { "add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee Posts"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({add: [{value: 'coffee -is:retweet', tag: 'Non-retweeted coffee Posts'}]})
};
fetch('https://api.x.com/2/tweets/search/stream/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/search/stream/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'add' => [
[
'value' => 'coffee -is:retweet',
'tag' => 'Non-retweeted coffee Posts'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/search/stream/rules"
payload := strings.NewReader("{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.x.com/2/tweets/search/stream/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/search/stream/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"sent": "<string>",
"next_token": "<string>",
"result_count": 123,
"summary": {
"created": 1,
"invalid": 1,
"not_created": 1,
"valid": 1
}
},
"data": [
{
"value": "coffee -is:retweet",
"id": "120897978112909812",
"tag": "Non-retweeted coffee Posts"
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}स्ट्रीम नियम अपडेट करें
फ़िल्टर की गई स्ट्रीम के लिए सक्रिय नियम-समूह में नियम जोड़ता या हटाता है।
curl --request POST \
--url https://api.x.com/2/tweets/search/stream/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee Posts"
}
]
}
'import requests
url = "https://api.x.com/2/tweets/search/stream/rules"
payload = { "add": [
{
"value": "coffee -is:retweet",
"tag": "Non-retweeted coffee Posts"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({add: [{value: 'coffee -is:retweet', tag: 'Non-retweeted coffee Posts'}]})
};
fetch('https://api.x.com/2/tweets/search/stream/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/search/stream/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'add' => [
[
'value' => 'coffee -is:retweet',
'tag' => 'Non-retweeted coffee Posts'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/search/stream/rules"
payload := strings.NewReader("{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.x.com/2/tweets/search/stream/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/search/stream/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add\": [\n {\n \"value\": \"coffee -is:retweet\",\n \"tag\": \"Non-retweeted coffee Posts\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"sent": "<string>",
"next_token": "<string>",
"result_count": 123,
"summary": {
"created": 1,
"invalid": 1,
"not_created": 1,
"valid": 1
}
},
"data": [
{
"value": "coffee -is:retweet",
"id": "120897978112909812",
"tag": "Non-retweeted coffee Posts"
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}प्राधिकरण
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
क्वेरी पैरामीटर
Dry Run का उपयोग add और delete, दोनों कार्रवाइयों के साथ किया जा सकता है, जिसमें अपेक्षित परिणाम दिया जाता है, लेकिन सिस्टम में वास्तव में कोई कार्रवाई नहीं की जाती (अर्थात, अंतिम स्थिति वही रहेगी जो अनुरोध सबमिट किए जाने के समय थी)। यह नियमों में किए गए बदलावों को सत्यापित करने के लिए विशेष रूप से उपयोगी है।
Delete All का उपयोग इस client app से जुड़े सभी नियमों को हटाने के लिए किया जा सकता है; इसे किसी अन्य पैरामीटर के बिना निर्दिष्ट किया जाना चाहिए। एक बार हटाए जाने के बाद, नियम पुनर्प्राप्त नहीं किए जा सकते।
बॉडी
- Option 1
- Option 2
उपयोगकर्ता-निर्दिष्ट स्ट्रीम फ़िल्टरिंग नियम जोड़ने का अनुरोध।
Show child attributes
Show child attributes
प्रतिक्रिया
अनुरोध सफल रहा है।
उपयोगकर्ता-निर्दिष्ट स्ट्रीम फ़िल्टरिंग नियमों में संशोधन का रिस्पॉन्स।
Show child attributes
Show child attributes
बनाए गए सभी उपयोगकर्ता-निर्दिष्ट स्ट्रीम फ़िल्टरिंग नियम।
Show child attributes
Show child attributes
1IETF RFC 7807 (https://tools.ietf.org/html/rfc7807) में परिभाषित एक HTTP Problem Details ऑब्जेक्ट।
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
Show child attributes
Show child attributes