Collections > Create a collection
To create collections in Tallyfy Answers you must first make a POST request to the /v1/collections endpoint with a unique collection name and optional description before adding any objects to the collection.
This endpoint allows you to modify certain properties of an existing collection in Tallyfy Answers, such as its description or configuration settings. The collection name cannot be changed once it’s created.
PATCH /v1/collections/{collection_name}
Parameter | Type | Required | Description |
---|---|---|---|
collection_name | string | Yes | Name of the collection to update |
The request body should contain a JSON object with the properties you want to update:
Parameter | Type | Required | Description |
---|---|---|---|
description | string | No | New description for the collection |
Example request body:
{ "description": "Updated collection of premium electronics products"}
A successful update returns a 200 OK
status code and a JSON response containing the updated collection:
{ "name": "products", "description": "Updated collection of premium electronics products", "schema": { "name": { "type": "string" }, "price": { "type": "number" }, "categories": { "type": "string[]" } }, "created_at": "2023-08-15T14:32:21Z", "updated_at": "2023-09-05T10:15:42Z"}
Status | Description |
---|---|
404 | Collection not found |
400 | Invalid request format or parameters |
curl -X PATCH https://go.tallyfy.com/api/collections/products \ -H "X-Answers-API-Key: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "description": "Updated collection of premium electronics products" }'
There are several situations where updating a collection is useful:
Collections > Create a collection
Collections > Get a collection
Collections > Delete a collection
Tallyfy auto-detects data types (string, number, array) when new objects are added to collections ↩