NitDef
#1
I’m using sample code from
Issue that I notice is that the returned matching_rules does not match the results from
GET /2/tweets/search/stream/rules
matching_rule ID that I received from the stream: 1337137539379941400
matching_rule list that I received from the endpoint: ['1337137536435515392', '1337137539379941376']
This happens to me as well! Would love an update from someone at Twitter Dev Support
Pretty sure it’s the same here:
NitDef
#4
Sorry for the late update here. One thing that keeps bugging me here is the type difference. When I receive the record from the filter stream, the matching_rule’s ID seems to be a number (without quote around it). As comparison, data.id of the same response is wrapped with quotes.
{"data":{"id":"1437525241786425353","text":"Footage of the semi-final match of the inaugural women's Clear Currency All-Ireland T20 Cup, broadcast by Cricket Ireland, showed the dog running onto the pitch to intercept the ball during play 🐶\n\nToday's top stories: https://t.co/4ozTbgvoxl https://t.co/C2r238OUlZ"},"matching_rules":[{"id":1436114489988968481,"tag":"dog videos"}]}
While making add_rule request, the response looks like following:
{
data: [
{
value: 'cats has:videos',
tag: 'cats videos',
id: '1437524638125346816'
}
],
meta: {
sent: '2021-09-13T21:12:36.349Z',
summary: { created: 1, not_created: 0, valid: 1, invalid: 0 }
}
}
So I wonder if there is a type conversion error occurred somehow while forming the response here.
No JSON.parse() is applied while logging both response bodies, and I’m using request with configuration:
const request = _request.defaults({ baseUrl: BASE_URL, encoding: 'utf8', auth: { bearer: TWITTER_TOKEN }})
I think the current response only has id than the id_str that was suggested in the link that you posted. Wonder if it’s something that is WIP.
1 Like
You’re right:
"matching_rules":[{"id":1436114489988968481,"tag":"dog videos"}]
I think is a mistake in the API - it should be
"matching_rules":[{"id":"1436114489988968481","tag":"dog videos"}]
(as a string) to be more compatible. I haven’t noticed this myself - using python the ids parse correctly.
Maybe the best place to suggest an improvement is on GitHub - twitterdev/open-evolution: Open evolution proposals for the Twitter API