Microservices

Microservices

In addition to the data stored in the RedShred database, we publish several microservices as part of the platform. The low level documentation for these is available through the OpenAPI documentation, but we provide a few specific examples here.

Token Lookups

Sometimes you’ll create a new segment in your very own perspective and may want to query for a region of the page that isn’t represented by a single segment. In these cases, you can pass a GeoJSON polygon to the tolo-text (token-lookup text) endpoint.

curl -H "Authorization: Token $REDSHRED_AUTH_TOKEN"  \
     -H "Content-Type: application/json" \
     -X GET "https://api.redshred.com/v2/collections/$COLLECTION/services/tolo-text?regions=$GEOJSON_REGIONS"
from redshred import RedShredClient

rs = RedShredClient()
segment = next(rs.collection(collection).segments())
text = segment.get_text()