Related

This endpoint can be used to fetch related documents. For this endpoint to work you need to setup the different AI models as specified on the homepage of this documentation. The @related endpoint will return all the related documents based on embedding vectors. You can do the following request:

GET /news/@related HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk

Or use the client directly:

import { Client } from '@robgietema/nick';

const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });

const { data } = await cli.getRelated({
  token: login.data.token,
  path: '/news',
});

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@id": "http://localhost:8080/news/@related",
  "items": [
    {
      "@id": "http://localhost:8080/events",
      "@type": "Folder",
      "title": "Events",
      "UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
      "path": "/events",
      "Description": null,
      "Title": "Events",
      "Subject": null,
      "is_folderish": true,
      "exclude_from_nav": false,
      "Type": "Folder",
      "getId": "events",
      "Creator": "admin",
      "id": "events",
      "portal_type": "Folder",
      "review_state": "published",
      "modified": "2022-04-02T20:30:00.000Z",
      "Date": "2022-04-02T20:30:00.000Z",
      "expires": null,
      "created": "2022-04-02T20:30:00.000Z",
      "effective": "2022-04-02T20:30:00.000Z",
      "getObjSize": 192,
      "listCreators": [
        "admin"
      ],
      "mime_type": null,
      "CreationDate": "2022-04-02T20:30:00.000Z",
      "EffectiveDate": "2022-04-02T20:30:00.000Z",
      "ExpirationDate": null,
      "ModificationDate": "2022-04-02T20:30:00.000Z",
      "image_field": "",
      "image_scales": {},
      "hasPreviewImage": false,
      "similarity": 0.6123342903959068
    },
    {
      "@id": "http://localhost:8080/events/event-1",
      "@type": "Page",
      "title": "Event 1",
      "UID": "405ca717-0c68-43a0-88ac-629a82658675",
      "path": "/events/event-1",
      "Description": null,
      "Title": "Event 1",
      "Subject": [
        "event"
      ],
      "is_folderish": true,
      "exclude_from_nav": false,
      "Type": "Page",
      "getId": "event-1",
      "Creator": "admin",
      "id": "event-1",
      "portal_type": "Page",
      "review_state": "published",
      "modified": "2022-04-02T20:10:00.000Z",
      "Date": "2022-04-02T20:10:00.000Z",
      "expires": null,
      "created": "2022-04-02T20:10:00.000Z",
      "effective": "2022-04-02T20:10:00.000Z",
      "getObjSize": 421,
      "listCreators": [
        "admin"
      ],
      "mime_type": null,
      "CreationDate": "2022-04-02T20:10:00.000Z",
      "EffectiveDate": "2022-04-02T20:10:00.000Z",
      "ExpirationDate": null,
      "ModificationDate": "2022-04-02T20:10:00.000Z",
      "image_field": "",
      "image_scales": {},
      "hasPreviewImage": false,
      "similarity": 0.4926838666935264
    },
    {
      "@id": "http://localhost:8080/users",
      "@type": "Folder",
      "title": "Users",
      "UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
      "path": "/users",
      "Description": null,
      "Title": "Users",
      "Subject": null,
      "is_folderish": true,
      "exclude_from_nav": false,
      "Type": "Folder",
      "getId": "users",
      "Creator": "admin",
      "id": "users",
      "portal_type": "Folder",
      "review_state": "published",
      "modified": "2022-04-02T20:24:00.000Z",
      "Date": "2022-04-02T20:24:00.000Z",
      "expires": null,
      "created": "2022-04-02T20:24:00.000Z",
      "effective": "2022-04-02T20:24:00.000Z",
      "getObjSize": 191,
      "listCreators": [
        "admin"
      ],
      "mime_type": null,
      "CreationDate": "2022-04-02T20:24:00.000Z",
      "EffectiveDate": "2022-04-02T20:24:00.000Z",
      "ExpirationDate": null,
      "ModificationDate": "2022-04-02T20:24:00.000Z",
      "image_field": "",
      "image_scales": {},
      "hasPreviewImage": false,
      "similarity": 0.42598878067772117
    },
    {
      "@id": "http://localhost:8080/",
      "@type": "Site",
      "title": "Welcome to Nick!",
      "UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
      "path": "/",
      "Description": "Congratulations! You have successfully installed Nick.",
      "Title": "Welcome to Nick!",
      "Subject": null,
      "is_folderish": true,
      "exclude_from_nav": null,
      "Type": "Site",
      "getId": "root",
      "Creator": "admin",
      "id": "root",
      "portal_type": "Site",
      "review_state": "published",
      "modified": "2022-04-02T20:00:00.000Z",
      "Date": "2022-04-02T20:00:00.000Z",
      "expires": null,
      "created": "2022-04-02T20:00:00.000Z",
      "effective": "2022-04-02T20:00:00.000Z",
      "getObjSize": 1806,
      "listCreators": [
        "admin"
      ],
      "mime_type": null,
      "CreationDate": "2022-04-02T20:00:00.000Z",
      "EffectiveDate": "2022-04-02T20:00:00.000Z",
      "ExpirationDate": null,
      "ModificationDate": "2022-04-02T20:00:00.000Z",
      "image_field": "",
      "image_scales": {},
      "hasPreviewImage": false,
      "similarity": 0.41005329819281644
    }
  ]
}