Loading...
Skip to main content

Corpus API Examples: Working with Corpora

This page provides examples for how to use the Corpus API to work with corpora. Most if not all of what is covered here can also be accomplished by using the Fixie Console. Examples are provided in four flavors with each of those corresponding with the method of calling the Corpus API: via curl, using the Fixie CLI via the terminal, using the Fixie client in JavaScript, and using the Corpus REST API in Python.

Notes on Authentication

Calling the Corpus API requires a Fixie account. For the examples using curl or the REST API (in JS or Python), you will need to provide your Fixie API key. The examples use <TOKEN> to denote where you need to provide your key. You can find your API key (AKA "API token") on your profile page.

When you use the Fixie CLI, you will need to use the auth command. See the docs for more information.

Create Corpus

Create a new corpus that will contain information about Fixie.ai. Name the corpus "Fixie.ai Corpus" and give it a description of "Fixie.ai info including the company website, blog, and product documentation."

See the Corpus API docs for more information.

curl -L -X POST 'https://api.fixie.ai/api/v1/corpora' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"corpus": {
"displayName": "Fixie.ai Corpus",
"description": "Fixie.ai info including the company website, blog, and product documentation."
}
}'

Delete Corpus

Delete corpus with ID 74e5bc4c-c2d9-4296-a2de-9c448d4bc307.

See the Corpus API docs for more information.

curl -L -X DELETE 'https://api.fixie.ai/api/v1/corpora/74e5bc4c-c2d9-4296-a2de-9c448d4bc307' \
-H 'Authorization: Bearer <TOKEN>'