Tags

Tag types

See the tagType object from the shared lib. Each type is self-explanatory and has a number ID.

Get tags

getTags Authentication needed Frontend needs to be restricted or open

Query list of tags in the database

Request
{
    type: 5,         // filter tags by a certain type (language here)
    filter: 'fre',   // filter by a string
    from: 0,         // where to start, use for pagination
    size: 30,        // how many records, use for pagination,
    stripEmpty: true // Strip tags with 0 songs attached to them
}

This return an object with several important properties.

  • infos contains information about the results. Number of total results, from and to which (for pagination)
  • content contains a tag object. See example response for details
Response
{
    "content": [
      {
        tid: 'abcdef',
        types: [2, 5],               // Tag belongs to two types
        name: 'My tag name',
        short: 'TAG'                 // Short (3 or 4 characters-long) name
        i18n: {
            fre: 'lol',
            eng: 'lol'
        },
        aliases: [                   // Aliases are used for search only
            'MTN'
        ],
        karacount: [                 // Number of songs the tag is in
            { type: 2, count: 523 }, // This is by type the tag belongs to
            { type: 5, count: 10 }
        ],
        tagfile: 'My tag name.abcdef.tag.json',
        repository: 'kara.moe',
        karafile_tag: null, // A small tag to add to kara file names if this tag is in it.
        noLiveDownload: false        // forbid any song with this tag to be viewable/downloadable on KM Explorer,
        priority: 5,                  // Low priority means the tag is displayed first if several tags of the same type are on the same song. -1 means it's hidden from public view,
        description: {
            eng: 'This is a tag description'
        }
      }
    ],
    infos: {
        count: 201,
        from: 0,
        to: 201
    }
}
Response
{
    code: 500,
    message: {
        code: 'TAG_LIST_ERROR'
    }
}

Create tag

addTag Operator user required Frontend can be closed, restricted or open

Create a new tag in a repository

Request
{
    types: [2, 5],
    name: 'My tag',
    short: 'TAG'           // optional
    repository: 'kara.moe',
    problematic: false     // optional
    noLiveDownload: false  // optional
    i18n: {
        eng: 'lol'
    },
    aliases: [],
    priority: 5            // optional
}
Response
{
    code: 200, 
    message: {
        code: 'TAG_CREATED'
        data: <tag object>
    }
}
Response
{
    code: 500,
    message: {
        code: 'TAG_CREATE_ERROR'
    }
}

Get list of years

getYears Authentication needed Frontend needs to be restricted or open

Get list of years currently known to the database, with the number of songs in each year

Response
{
    content: [
        {
            year: 1982,
            karacount: 50 // number of songs for that year
        },
        ...
    ]
    infos: {
        from: 0,
        to: 55, // number of years
        count: 55
    }
}
Response
{
    code: 500,
    message: {
        code: 'YEARS_LIST_ERROR'
    }
}

Get duplicate tags

getDuplicateTags Operator user required Frontend can be closed, restricted or open

List tags with the same names.T his helps identify when two tags have the same name because they're actually the same but have been created twice by mistake (for example they belong to two different types) or if they're actually two different entities.

Example :

"STUFF" is both a singer and songwriter but has been created twice by mistake. You should merge them.

"SOMEONE" is both a singer and songwriter but actually two different people entirely.

See Get Tags response

Response
{
    code: 500,
    message: {
        code: 'TAG_DUPLICATE_LIST_ERROR'
    }
}

Merge tags

mergeTags Operator user required Frontend can be closed, restricted or open

Merge two tags together. The first tag will be kept, the second removed once all its information has been added to the first.

Request
{
    tid1: 'abcdef',
    tid2: 'ghijkl'
}
Response
{
  code: 200
  message: {
    code: 'TAGS_MERGED',
    data: <tag object>
  }
}
Response
{
    code: 500,
    message: {
        code: 'TAGS_MERGED_ERROR'
    }
}

Remove tag

deleteTag Operator user required Frontend can be closed, restricted or open

Remove one or more tags from database and repository

Request
{
  tids: ['aaaaaaaaa']
}
Response
{
    code: 200,
    message: {
        code: 'TAG_DELETED',        
    }
}
Response
{
    code: 500,
    message: {
        code: 'TAG_DELETE_ERROR'
    }
}

Get single tag

getTag Operator user required Frontend can be closed, restricted or open

Get a single tag

Request
{
  tid: 'aaaaaaaaa'  
}

See Get Tags response

Response
{
    <tag object>
}
Response
{
    code: 500,
    message: {
        code: 'TAG_GET_ERROR'
    }
}
Response
{
    code: 404,
    message: {
        code: 'TAG_GET_ERROR'
    }
}
Response
{
    code: 400
}

Edit tag

editTag Operator user required Frontend can be closed, restricted or open

Edit a tag with new information

See Edit Tag request except you need to add a tid property, and all properties are now required.

Response
{
    code: 200,
    message: {
        code: 'TAG_EDITED'
    }
}
Response
{
    code: 500,
    message: {
        code: 'TAG_EDIT_ERROR'
    }
}

Copy tag to another repository

copyTagToRepo Operator user required Frontend can be closed, restricted or open

Copy a tag to a new repository

Request
{
  tid: 'abcdef'
  repo: 'world.karaokes.moe'
}
Response
{
    code: 200
    message: {
        code: 'TAG_COPIED'
    }
}
Response
{
    code: 500
    message: {
        code: 'TAG_COPIED_ERROR'
    }
}

Get collections

getCollections Operator user required Frontend can be closed, restricted or open

Get list of collections available. It fetches from all online repositories first, but if some are not reachable, local tags will be used instead.

See getTags for tag objects.

Response
[
    <tag object>
]
Response
{
    code: 500
    message: {
        code: 'COLLECTIONS_GET_ERROR'
    }
}