Download Modifiying documents with the Talkwalker API
Transcript
Credits
Each result (independent on how many rules match) will be counted as 1 credit. If no credits are left, the stream is
stopped and a control chunk containing the timestamp of the end of the stream (needed for resuming) is sent. API calls
which don’t return any results are not counted. The documents are billed after every completed timeframe, if a stream
gets disconnected a non completed timeframe will not be billed. (When resuming a disconnected stream, a partially
streamed timeframe has to be restarted and streamed again.) When the parameter
max_hits
is set, only the specified
maximum number of results will be billed, even if the entire timeframe gets streamed after reaching the limit.
Order and Timing of Chunks
It is not possible to do any custom sorting with the Talkwalker Streaming API. The data is grouped in unsorted
timeframes, which will be returned in the order the data was added to Talkwalker. (This can be a different order than
the order the data was published in.)
The number of results chunks in a timeframe is not limited! When implementing a client application, store or
process the results in a reasonable batch size (to limit memory usage and prevent out of memory) and do not
wait for a completed timeframe.
Stream Results
To start streaming the results from a stream at least one rule needs to be defined. The results are available at
https://api.talkwalker.com/api/v/stream/s/<stream_id>/results.
Example: Start a stream:
curl https://api.talkwalker.com/api/v2/stream/s/teststream/results?access_token=demo
Example: Resume a disconnected stream: Set the parameter stream_resume to the start timestamp ('timeframe_start') of the
last
CT_CONTROL
chunk. Since the results in a timeframe are not sorted, the streaming of the entire timeframe has to be
restarted.
curl
https://api.talkwalker.com/api/v2/stream/s/teststream/results?access_token=demo&stream_resume=1388534400000
Parameters
parameter
description
required?
access_token
a read/write token specified in the API application
required
q
The query to search for.
optional
stream_resume
Resumes the stream from this starting point
optional
stream_stop
Stops the stream at this point
optional
max_hits
Stops the stream after the given number of hits
optional
default value
now