Create a vocabulary - Fluid Topics - Latest

Fluid Topics API Reference Guide

Category
Reference Guides
Audience
public
Version
Latest

This web service creates a new vocabulary.

Method Endpoint
POST /api/admin/khub/vocabularies

Request example

To create a vocabulary, the web service call requires a multipart/form-data request body where the different parts consist in:

  • A configuration file, which must be named vocabulary.json.
  • A CSV or RDF file containing the terms of the vocabulary.

The mimeType defined in the configuration file must match the Content-Type defined for the file containing the terms of the vocabulary.

The following cURL command is a call example:

curl --location 'https://my-fluidtopics.net/api/admin/khub/vocabularies' \
     --header 'Authorization: Bearer $API-KEY' \
     --form 'vocabulary.json=@"vocabulary.json"' \
     --form 'latest_version.csv=@"latest_version.csv"'

Where the content of vocabulary.json is the following:

{
    "id": "new-vocabulary",
    "locales": [
        "en-US"
    ],
    "description": "a description of my new vocabulary",
    "mimeType": "text/csv",
    "usedInSearch": true,
    "mode": "FULL"
}
Field Type Required? Description
id String Yes The vocabulary's unique identifier.
locales Array Yes The languages in which the vocabulary is available.
description String Yes Use at least two terms and as many as needed to describe the vocabulary.
mimeType String Yes Defines the format of the file containing the terms of the vocabulary. Possible values are text/csv and application/rdf+xml.
usedInSearch Boolean Yes Defines whether the search engines uses the vocabulary when indexing content.
mode String Yes The mode of the vocabulary as it appears in the Back Office. Possible values are FULL for taxonomies and LIST for synonyms.
Return code Description
201 CREATED The request is valid and data was returned.
400 BAD REQUEST The request is invalid.
401 UNAUTHORIZED The authorization header was not provided or is invalid.
403 FORBIDDEN The user not have the ADMIN or KHUB_ADMIN role.

For a list of all possible return codes, see Return codes.