Content in RedShred is grouped into collections. Each collection is a group of document that shares a common configuration. Let’s make a new collection and upload a sample document to start making queries.
The first step is to create the collection.
Collection names are transformed into slugs so that spaces and other special characters can be used in collection names. Collection slugs must be unique, so you may encounter an error when running or re-running this tutorial. If so, just change the name of the collection and try again.
curl --config redshred-auth -X POST https://api.redshred.com/v2/collections/ \
-H "Content-Type: application/json" \
-d '{"name": "My Test Collection"}'
from redshred import SimpleAPI
api = SimpleAPI(raw_responses=True)
response = api.post("/collections/", {"name": "My Test Collection"})
The response should look something like:
{
"config": {
// ... configuration details ...
},
"created_at": "2022-09-04T20:42:50.182823Z",
"created_by": "jmk+admin@redshred.com",
"description": null,
"documents_link": "https://api.redshred.com/v2/collections/my-test-collection/documents",
"id": "3wWzzZ2n8zvHEth3UY4SMx",
"marked_for_delete": null,
"metadata": null,
"name": "My Test Collection",
"owner": "jmk+admin@redshred.com",
"perspectives_link": "https://api.redshred.com/v2/collections/my-test-collection/perspectives",
"segments_link": "https://api.redshred.com/v2/collections/my-test-collection/segments",
"self_link": "https://api.redshred.com/v2/collections/my-test-collection",
"slug": "my-test-collection",
"updated_at": "2022-09-04T20:42:50.182854Z",
"updated_by": "jmk+admin@redshred.com",
"user_data": null
}
For purposes of this tutorial, the default configuration will suffice to get started. The details of the configuration will be covered in a later tutorial.