NAV
shell java javascript

Download Grafo Client Starter Pack

The grafo-client tar/zip can be downloaded from following link.

Grafo Client 1.0.0 Starter Pack tar

Grafo Client 1.0.0 Starter Pack zip

Tar/Zip Contents

Introduction

Welcome to the Grafo Client API! You can use our API to access Grafo endpoints at https://app.gra.fo to search, fetch your documents (or documents shared with you), folders, corresponding EKG documents and work on them programmatically to add/update/delete them or their constituent entites.

Apart from raw REST API support, we also have language bindings in Java, and JavaScript! You can view code examples in the area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Errors

Grafo uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a EKG save failed due to validation error, etc.). Codes in the 5xx range indicate an error with Grafo's servers (these are rare).

The Grafo API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong. (needs revisit into Grafos login and fix things)
403 Forbidden -- The entity requested is hidden for administrators only.
404 Not Found -- The specified entity could not be found.
405 Method Not Allowed -- You tried to access a entity with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The entity requested has been removed from our servers.
418 The request was not completely processed.
429 Too Many Requests -- You're requesting too many Grafo Entities! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Error Attributes

Attribute Description
error Short description of the error.
detail Longer error description if available

Handling Errors

API Libraries throw the errors as GrafoClientTransportException (java) or a subclass. These are runtime exceptions and hence need not be caught at compile time. However if the parent class (GrafoClientTransportException) is caught, then it provides an oppportunity to deal with exceptions in a app specific manner if the default throw all the way to the top is not gracious.

Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list folders, list documents, and list attributes for a concept.

These list API methods share a common structure, taking these two parameters: limit, and page.

Subsequent requests can submit the page as part of the query parameters.

Pagination Query Parameters

Parameter Default Mandatory Description
limit 50 false If set, the number of records is equal to or less than limit.
page 1 false The value has to be set for subsequent pages.

Entities supporting pagination

  1. Folder
  2. Document
  3. Shared Document
  4. Comment

Entities that do not support pagination

  1. Concept
  2. Relationship
  3. Attribute (both Concept and Relationship Attributes)
  4. Field (Concept Field, Relationship Field, Concept Attribute Field, and Relationship Attribute Field)

Logging

Grafo-client provides logging feature.

Java uses slf4j. The logging can be configured in logback.xml.

Javascript uses winston logger. More information on this is available at winston

@slf4j
public class demo {

  public void createConcept () {
    log.info("Creating Concept");
    .......

  }
}

'use strict';

var winston = require('winston');
var GrafoClient = require('grafo-client/lib/grafo_client');

var logOptions = {
    file: {
        level: 'debug',
        filename: 'C:/grafo-client.log',
        handleExceptions: true,
        json: true,
        maxsize: 5242880, // 5MB
        maxFiles: 5,
        colorize: false,
    },
    console: {
        level: 'debug',
        handleExceptions: true,
        json: false,
        colorize: true
    }
};

var doGrafo = async function() {
    try {
        var logger = winston.createLogger({
            level: 'debug',
            transports: [
                new (winston.transports.Console)(logOptions.console),
                new winston.transports.File(logOptions.file)
            ], exceptionHandlers: [ new winston.transports.Console() ]
        });

        logger.info("Starting Grafo Client Example");

        var grafoClient = new GrafoClient();

        //Pass the logger variable to grafoclient's init method
        //config variable is used for authentication details. Check Authentication section for more information on this.
        await grafoClient.init(config, logger);
        logger.info("Authenticated");

        //.. write actual grafo client code here

        await grafoClient.close();
    } catch(err) {
        logger.info(err);
    }
};

doGrafo();

Authentication

To authenticate, use this code:

import com.capsenta.grafo.GrafoClient;

/* Grafo Client constructor looks for grafo-client.properties in 
   classpath and uses the 4 properties:  
   grafo.server, grafo.email, grafo.password and grafo.token
   defined in that file to automatically login */
try ( GrafoClient gClient = new GrafoClient(); ) {
 ...
}
# With shell, you first login by posting the authentication details
# Session Cookie is returned by server. 
# Save the session cookie to a file 
# ( directories in cookie file path should pre exist. 
#   Curl does not create the directory )
curl 
    --header "Content-Type: application/json" 
    --cookie-jar /home/gopher/grafo_cookie.txt 
    --data '{"emailAddress":"support@capsenta.com", "password":"Grafo123", "token": "cdd31f91e32e771dfc4de05"}' 
    --request POST 
    https://app.gra.fo/api/v1/login
OR
curl 
    -H "Content-Type: application/json" 
    -c /home/gopher/grafo_cookie.txt 
    -d '{"emailAddress":"support@capsenta.com", "password":"Grafo123", "token": "cdd31f91e32e771dfc4de05"}' 
    -X POST 
    https://app.gra.fo/api/v1/login

# From now onwards, the saved cookie file can be used for every REST API call
# Like this
curl -b /home/gopher/grafo_cookie.txt https://app.gra.fo/api/v1/documents

# Note: -b <<cookie file>> reference will not be shown in 
# curl commands henceforth. It needs to be added everytime
// Create a conf.js like this using your config params
module.exports = {
  GRAFO: {
    SECURE: true,
    SERVER: "app.gra.fo",
    PORT: 401,
    DEFAULT_LOGIN: {
      EMAIL: "support@capsenta.com",
      PASSSWORD: "Grafo123",
      TOKEN: "cdd31f91e32e771dfc4de05"
    },
    OT: {
        UPDATE_INTERVAL_IN_MS: 100
      }
  }
}

//grafo api access code elsewhere in another js
'use strict';

var config = require('./conf.js');
var GrafoClient = require('grafo-client/lib/grafo_client');

var doGrafo = async function() {
    try {
        console.log("Starting Grafo Client Example");

        var grafoClient = new GrafoClient();

        console.log("Authenticating to Grafo with provided config : ");
        console.log(config);

        await grafoClient.init(config);
        console.log("Authenticated");

        //.. write actual grafo client code here

        await grafoClient.close();
    } catch(err) {
        console.log(err);
    }
};

doGrafo();

Make sure to replace emailAddress, password, and token with appropriate values.

Grafo Client uses a combination of userid, password and a developer token to allow access to the API. You can get a developer token from Grafo.

A session cookie is issued after successful authentication. Grafo expects the session cookie to be included in all API requests to the server in the header:

connect.sid s%3A2qhmWErcbzkJJeF4xlc5wV8d7Rt0tXV9.wrpCoeXWQ37%2FGpjgrF1Npviu%2F3BlqWvFcR7c384RhMs

Folders

Folders are logical containers for grouping documents.

List Folders

This endpoint retrieves all of your folders. The folders are returned sorted by creation date, with the most recent folder appearing first.

try ( GrafoClient gClient = new GrafoClient(); )
{   
  ResourceSearchCriteria resSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false);
  for (Iterator<Folder> folderIter = gClient.getFolders(resSearchCrit); folderIter.hasNext();)
  {
    Folder folder = folderIter.next();
    folder.getId(); folder.getTitle(); folder.getDescription(); 
    folder.getDateCreated(); folder.getDateDeleted();
    Boolean isDeleted = folder.getDeleted();
    UUID parentFolderId = folder.getParent();  
    UUID owner = doc.getOwner();  
  }
}

//Resource Search Criteria to list documents created on 2018 Oct 17     
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOn(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created before 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdBefore(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created on or after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOnOrAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created between 2018 Oct 05 and 2018 Oct 17
//(Both dates inclusive)
  ResourceSearchCriteria docSearchCrit = new ResourceSearchCriteria()
                    .createdBetween(LocalDate.of(2018, 10, 05), LocalDate.of(2018, 10, 17), InclusionType.IncludeStartAndEndDate)
                    .limit(20).deleted(false);
# No search criteria. get 1st page and limit to 50
curl https://app.gra.fo/api/v1/folders

#List my deleted folders 2nd page and limit 20
curl https://app.gra.fo/api/v1/folders?page=2&limit=20&deleted=true

#List Folders created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/folders?created=2019-01-23

#List Folders created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/folders?created[lte]=2019-01-23

#List Folders created before 2019 Jan 23
curl https://app.gra.fo/api/v1/folders?created[lt]=2019-01-23

#List Folders created after 2017 March 5
curl https://app.gra.fo/api/v1/folders?created[gt]=2017-03-05

#List Folders created on or after 2017 March 5
curl https://app.gra.fo/api/v1/folders?created[gte]=2017-03-05

# List Folders created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/folders?created[gt]=2017-03-05&created[lt]=2019-01-23

# List Folders created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/folders?created[gte]=2017-03-05&created[lte]=2019-01-23
//List folders created on 2018 Oct 24 (limit 5, 1st page, without parent folder and not deleted)
var resSearchCriteria = new ResourceSearchCriteria().setLimit(5).setPage(1).setDeleted(false).createdOn('2018-10-24');
var allFolders = await grafoClient.getFolders(resSearchCriteria);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "page": "1",
  "folders": [
    {
      "id": "536a35f8-cb7b-41c6-a834-c4c03516657a",
      "title": "inventory_docs",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "dateCreated": 2018-10-24,
      "dateDeleted": null,
      "parent": "",
      "deleted": 0
    },
    {
      "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
      "title": "hr_docs`",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "dateCreated": 2018-10-24,
      "dateDeleted": null,
      "parent": "",
      "deleted": 0
    }
  ]
}

HTTP Request

GET http://example.com/api/v1/folders

Query Parameters

Common List Paging params of page and limit are supported.

Parameter Child Arguments Default Mandatory Description
parent '' false If set, the folders within another folder whose id is this will be listed.
deleted 0 false If set to true, then the folders returned are only those that are deleted.
created false Optional filter on the list based on the created field. Exact check. This (and all child argument) values are in yyyy-MM-dd format
gt false Optional lower bound filter for the created field in list. Excludes the entities created on lower bound itself
gte false Optional lower bound filter for the created field in list. Includes the entities created on lower bound.
lt false Optional upper bound filter for the created field in list. Excludes the entities created on upper bound itself
lte false Optional upper bound filter for the created field in list. Includes the entities created on upper bound.

Returns

This returns a JSON object containing array of folders and the page number. The array contains folders limited by the limit requested (or less if this is the last page), for the current page requested. Each entry in the array is a separate folder object.

Get Folder

//Pass the Id of the folder to retrieve
try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = gClient.getFolder(UUID.fromString("954423eb-9a36-42d7-b054-7fd1c905d53a"));
  UUID owner = folder.getOwner();
}
curl "https://app.gra.fo/api/v1/folders/954423eb-9a36-42d7-b054-7fd1c905d53a"
//Pass the Id of the folder to retrieve
var folder = await  grafoClient.getFolder('536df107-2395-4e7f-9ee7-f177a9b759d6');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "title": "hr_docs",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24,
  "dateDeleted": null,
  "parent": "",
  "deleted": 0
}

This endpoint retrieves a specific folder by id.

HTTP Request

GET https://app.gra.fo/api/v1/folders/<ID>

URL Parameters

Parameter Description
ID The ID of the folder to retrieve

Returns

This returns a JSON object for the folder.

Create Folder

//New folder created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = new Folder();
  folder.setTitle("MyFolder_01");
  folder.setParent(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
  Folder folderCreated = gClient.createFolder(folder);
}
curl -X POST 
    -d '{"title": "MyFolder_01", "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b"}' 
    https://app.gra.fo/api/v1/folders
//New folder created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
Folder folder = new Folder();
  folder.setTitle("MyFolder_01");
  folder.setParent(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
var newFolder = await grafoClient.createFolder(folder);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "66aad20f-4ae6-49c9-b4f9-6b6281ec701a",
  "title": "MyFolder_01",
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24,
  "dateDeleted": null,
  "deleted": 0
}

This endpoint creates a folder.

HTTP Request

POST https://app.gra.fo/api/v1/folders

URL Parameters

None

JSON Body

Name Mandatory Default Description
title false "New Folder" Title of the folder
parent false - UUID of parent folder

Returns

This returns a JSON object for the created folder.

Update Folder

try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = 
      gClient.getFolder(
        UUID.fromString("66aad20f-4ae6-49c9-b4f9-6b6281ec701a")
      );
  folder.setTitle("NewFolderTitle");
  Folder updatedFolder = gClient.updateFolder(folder);
}
curl -X PUT 
    -d '{"title": "NewFolderTitle"}' 
    https://app.gra.fo/api/v1/folders/66aad20f-4ae6-49c9-b4f9-6b6281ec701a
var folder = await  grafoClient.getFolder('66aad20f-4ae6-49c9-b4f9-6b6281ec701a');
folder.setTitle("NewFolderTitle");
var updatedFolder = await grafoClient.updateFolder(folder);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "66aad20f-4ae6-49c9-b4f9-6b6281ec701a",
  "title": "NewFolderTitle",
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24,
  "dateDeleted": null,
  "deleted": 0
}

This endpoint updates my folder with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/folders/<ID>

URL Parameters

Parameter Description
ID The ID of the folder to retrieve

JSON Body

Name Mandatory Description
title false Title of the folder
parent false UUID of parent folder

Returns

This returns a JSON object for the updated folder.

Delete Folder

//Pass the Id of the folder to delete
try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = 
      gClient.getFolder(
        UUID.fromString("66aad20f-4ae6-49c9-b4f9-6b6281ec701a")
      );
  GenericGrafoResponse response = gClient.deleteFolder(folder.getId());
}
curl -X DELETE 
    https://app.gra.fo/api/v1/folders/66aad20f-4ae6-49c9-b4f9-6b6281ec701a
//Pass the Id of the folder to delete
var deletedFolder = await grafoClient.deleteFolder('66aad20f-4ae6-49c9-b4f9-6b6281ec701a');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes my folder for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/folders/<ID>

URL Parameters

Parameter Description
ID The ID of the folder to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Documents

Document is a lightweight placeholder for the actual EKG Document

List Documents

This endpoint retrieves all of your documents. The documents are returned sorted by creation date, with the most recent document appearing first.

// No Resource Search Criteria
try ( GrafoClient gClient = new GrafoClient(); )
{   
  ResourceSearchCriteria resSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false);
  for (Iterator<Document> docIter = gClient.getDocuments(resSearchCrit);
                            docIter.hasNext();) 
  {
    Document doc = docIter.next();
    doc.getId(); doc.getTitle(); doc.getIri(); doc.getIriPrefix();
    doc.getDescription(); doc.getDateCreated(); doc.getDateDeleted();
    Boolean isDeleted = doc.getDeleted();
    UUID parentFolderId = doc.getParent();
    UUID owner = doc.getOwner();
  }
}

//Resource Search Criteria to list documents created on 2018 Oct 17     
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOn(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created before 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdBefore(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created on or after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOnOrAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created between 2018 Oct 05 and 2018 Oct 17
//(Both dates inclusive)
  ResourceSearchCriteria docSearchCrit = new ResourceSearchCriteria()
                    .createdBetween(LocalDate.of(2018, 10, 05), LocalDate.of(2018, 10, 17), InclusionType.IncludeStartAndEndDate)
                    .limit(20).deleted(false);

# No search criteria. get 1st page and limit to 50
curl https://app.gra.fo/api/v1/documents

#List my deleted documents 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents?page=2&limit=20&deleted=true

#List Documents created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents?created=2019-01-23

#List Documents created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents?created[lte]=2019-01-23

#List Documents created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents?created[lt]=2019-01-23

#List Documents created after 2017 March 5
curl https://app.gra.fo/api/v1/documents?created[gt]=2017-03-05

#List Documents created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents?created[gte]=2017-03-05

# List Documents created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents?created[gt]=2017-03-05&created[lt]=2019-01-23

# List Documents created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents?created[gte]=2017-03-05&created[lte]=2019-01-23
//List documents created on 2018 Oct 24 (limit 5, 1st page, without parent folder and not deleted)
var resSearchCriteria = new ResourceSearchCriteria().setLimit(5).setPage(1).setDeleted(false).createdOn('2018-10-24');
var allDocs = await grafoClient.getDocuments(resSearchCriteria);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "page": "1",
  "documents": [
    {
      "id": "536a35f8-cb7b-41c6-a834-c4c03516657a",
      "title": "inventory_docs",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg",
      "iriPrefix": "gf",
      "description": "",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "commentNotificationType": "nothing",
      "lastModified": 2018-10-24,
      "dateCreated": 2018-10-24,
      "dateDeleted": null,
      "parent": "",
      "deleted": 0,
      "needForceDirectedLayout": 0
    },
    {
      "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
      "title": "hr_docs`",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg",
      "iriPrefix": "gf",
      "description": "",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "commentNotificationType": "nothing",
      "lastModified": 2018-10-24,
      "dateCreated": 2018-10-24,
      "dateDeleted": null,
      "parent": "",
      "deleted": 0,
      "needForceDirectedLayout": 0
    }
  ]
}

HTTP Request

GET http://example.com/api/v1/documents

Query Parameters

Common List Paging params of page and limit are supported.

Parameter Child Arguments Default Mandatory Description
parent '' false If set, the documents within another folder whose id is this will be listed.
deleted 0 false If set to true, then the documents returned are only those that are deleted.
created false Optional filter on the list based on the created field. Exact check. This (and all child argument) values are in yyyy-MM-dd format
gt false Optional lower bound filter for the created field in list. Excludes the entities created on lower bound itself
gte false Optional lower bound filter for the created field in list. Includes the entities created on lower bound.
lt false Optional upper bound filter for the created field in list. Excludes the entities created on upper bound itself
lte false Optional upper bound filter for the created field in list. Includes the entities created on upper bound.

Returns

This returns a JSON object containing array of documents and the page number. The array contains documents limited by the limit requested (or less if this is the last page), for the current page requested. Each entry in the array is a separate document object.

Get Document

//Pass the Id of the document to retrieve
try ( GrafoClient gClient = new GrafoClient(); ) {
  Document document = gClient.getDocument(UUID.fromString("954423eb-9a36-42d7-b054-7fd1c905d53a"));
  UUID owner = document.getOwner();
}
curl "https://app.gra.fo/api/v1/documents/954423eb-9a36-42d7-b054-7fd1c905d53a"
//Pass the Id of the document to retrieve
var doc = await  grafoClient.getDocument('954423eb-9a36-42d7-b054-7fd1c905d53a');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "954423eb-9a36-42d7-b054-7fd1c905d53a",
  "title": "hr_docs`",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "commentNotificationType": "nothing",
  "lastModified": 2018-10-27,
  "dateCreated": 2018-10-27,
  "dateDeleted": null,
  "parent": "",
  "deleted": 0,
  "needForceDirectedLayout": 0
}

This endpoint retrieves a specific document by id.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<ID>

URL Parameters

Parameter Description
ID The ID of the document to retrieve

Returns

This returns a JSON object for the document.

Create Document

//New document created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
try ( GrafoClient gClient = new GrafoClient(); ) {
  Document document = new Document();
  document.setTitle("MyDocument_01");
  document.setParent(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
  Document documentCreated = gClient.createDocument(document);
}
curl -X POST 
    -d '{"title": "MyDocument_01", "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b"}' 
    https://app.gra.fo/api/v1/documents
//New document created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
Document document = new Document();
  document.setTitle("MyDocument_01");
  document.setParent("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
var newDocument = await grafoClient.createDocument(document);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "954423eb-9a36-42d7-b054-7fd1c905d53a",
  "title": "MyDocument_01",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "commentNotificationType": "nothing",
  "lastModified": 2018-10-27,
  "dateCreated": 2018-10-27,
  "dateDeleted": null,
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "deleted": 0,
  "needForceDirectedLayout": 0
}

This endpoint creates a document.

HTTP Request

POST https://app.gra.fo/api/v1/documents

URL Parameters

None

JSON Body

Name Mandatory Default Description
title false "New Document" Title of the document
parent false - UUID of parent folder
iri false "http://www.app.gra.fo/schema/untitled-ekg" Iri
iriPrefix false "gf" Iri Prefix
description false - Description of the document
ownerCommentNotification false "nothing" Comment Notification Type
needForceDirectedLayout false false Flag to check if Force Directed Layout is required

Returns

This returns a JSON object for the created document.

Update Document

try ( GrafoClient gClient = new GrafoClient(); ) {
  Document document = 
      gClient.getDocument(
        UUID.fromString("66aad20f-4ae6-49c9-b4f9-6b6281ec701a")
      );
  document.setTitle("NewDocumentTitle");
  Document updatedDocument = gClient.updateDocument(document);
}
curl -X PUT 
    -d '{"title": "NewDocumentTitle"}' 
    https://app.gra.fo/api/v1/documents/66aad20f-4ae6-49c9-b4f9-6b6281ec701a
var docToUpdate = await grafoClient.getDocument("66aad20f-4ae6-49c9-b4f9-6b6281ec701a");
docToUpdate.setTitle("NewDocumentTitle");
var updatedDocument = await grafoClient.updateDocument(docToUpdate);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "66aad20f-4ae6-49c9-b4f9-6b6281ec701a",
  "title": "NewDocumentTitle",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "commentNotificationType": "nothing",
  "lastModified": 2018-10-27,
  "dateCreated": 2018-10-27,
  "dateDeleted": null,
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "deleted": 0,
  "needForceDirectedLayout": 0
}

This endpoint updates my document with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<ID>

URL Parameters

Parameter Description
ID The ID of the document to retrieve

JSON Body

Name Mandatory Description
title false Title of the document
iri false Iri
iriPrefix false Iri Prefix
description false Description of the document

Returns

This returns a JSON object for the updated document.

Delete Document

//Pass the Id of the document to delete
try ( GrafoClient gClient = new GrafoClient(); ) {
  Document document = 
      gClient.getDocument(
        UUID.fromString("66aad20f-4ae6-49c9-b4f9-6b6281ec701a")
      );
  GenericGrafoResponse response = gClient.deleteDocument(document.getId());
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/66aad20f-4ae6-49c9-b4f9-6b6281ec701a
//Pass the Id of the document to delete
var deletedDoc = await grafoClient.deleteDocument('66aad20f-4ae6-49c9-b4f9-6b6281ec701a');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes my document for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<ID>

URL Parameters

Parameter Description
ID The ID of the document to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Documents Shared with me

Documents shared with you by others are listed.

List Shared Documents

This endpoint retrieves all documents shared with you. The documents are returned sorted by creation date, with the most recent document appearing first.

// No Resource Search Criteria
try ( GrafoClient gClient = new GrafoClient(); )
{   
  ResourceSearchCriteria resSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false);
  for (Iterator<Document> docIter = gClient.getSharedDocumentsWithMe(resSearchCrit);
                            docIter.hasNext();) 
  {
    Document doc = docIter.next();
    doc.getId(); doc.getTitle(); doc.getIri(); doc.getIriPrefix();
    doc.getDescription(); doc.getDateCreated(); doc.getDateDeleted();
    Boolean isDeleted = doc.getDeleted();
    UUID parentFolderId = doc.getParent();
    UUID owner = doc.getOwner();
  }
}

//Resource Search Criteria to list documents created on 2018 Oct 17     
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOn(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created before 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdBefore(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created on or after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).deleted(false).createdOnOrAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created between 2018 Oct 05 and 2018 Oct 17
//(Both dates inclusive)
  ResourceSearchCriteria docSearchCrit = new ResourceSearchCriteria()
                    .createdBetween(LocalDate.of(2018, 10, 05), LocalDate.of(2018, 10, 17), InclusionType.IncludeStartAndEndDate)
                    .limit(20).deleted(false);
# No search criteria. get 1st page and limit to 50
curl https://app.gra.fo/api/v1/sharedWithMeDocuments

#List my deleted documents 2nd page and limit 20
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?page=2&limit=20&deleted=true

#List Documents created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created=2019-01-23

#List Documents created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[lte]=2019-01-23

#List Documents created before 2019 Jan 23
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[lt]=2019-01-23

#List Documents created after 2017 March 5
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[gt]=2017-03-05

#List Documents created on or after 2017 March 5
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[gte]=2017-03-05

# List Documents created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[gt]=2017-03-05&created[lt]=2019-01-23

# List Documents created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/sharedWithMeDocuments?created[gte]=2017-03-05&created[lte]=2019-01-23
//List documents created on 2018 Oct 24 (limit 5, 1st page, without parent folder and not deleted)
var resSearchCriteria = new ResourceSearchCriteria().setLimit(5).setPage(1).setDeleted(false).createdOn('2018-10-24');
var allDocs = await grafoClient.getSharedDocumentsWithMe(resSearchCriteria);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "page": "1",
  "documents": [
    {
      "id": "536a35f8-cb7b-41c6-a834-c4c03516657a",
      "title": "inventory_docs",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg",
      "iriPrefix": "gf",
      "description": "",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",      
      "lastModified": 2018-10-24,
      "dateCreated": 2018-10-24,
      "dateDeleted": null,
      "deleted": 0,
      "needForceDirectedLayout": 0,
      "parent": "",
      "sharedDate": 2018-10-24,    
      "commentNotificationType": "nothing",
    },
    {
      "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
      "title": "hr_docs`",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg",
      "iriPrefix": "gf",
      "description": "",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",      
      "lastModified": 2018-10-24,
      "dateCreated": 2018-10-24,
      "dateDeleted": null,      
      "deleted": 0,
      "needForceDirectedLayout": 0,
      "parent": "",
      "sharedDate": 2018-10-24,  
      "commentNotificationType": "nothing",
    }
  ]
}

HTTP Request

GET http://example.com/api/v1/documents

Query Parameters

Common List Paging params of page and limit are supported.

Parameter Child Arguments Default Mandatory Description
parent '' false If set, the documents within another document whose id is this will be listed.
deleted 0 false If set to true, then the documents returned are only those that are deleted.
created false Optional filter on the list based on the created field. Exact check. This (and all child argument) values are in yyyy-MM-dd format
gt false Optional lower bound filter for the created field in list. Excludes the entities created on lower bound itself
gte false Optional lower bound filter for the created field in list. Includes the entities created on lower bound.
lt false Optional upper bound filter for the created field in list. Excludes the entities created on upper bound itself
lte false Optional upper bound filter for the created field in list. Includes the entities created on upper bound.

Returns

This returns a JSON object containing array of documents and the page number. The array contains documents limited by the limit requested (or less if this is the last page), for the current page requested. Each entry in the array is a separate document object.

Get Shared Document

//Pass the Id of the document to retrieve
try ( GrafoClient gClient = new GrafoClient(); ) {
  Document document = gClient.getSharedDocumentWithMe(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
  UUID owner = document.getOwner();
}
curl "https://app.gra.fo/api/v1/documents/f16bb076-4fc4-43ab-bddc-e7e6433e497b"
//Pass the Id of the document to retrieve
var doc = await  grafoClient.getSharedDocumentWithMe('f16bb076-4fc4-43ab-bddc-e7e6433e497b');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
      "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
      "title": "hr_docs`",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg",
      "iriPrefix": "gf",
      "description": "",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",      
      "lastModified": 2018-10-24,
      "dateCreated": 2018-10-24,
      "dateDeleted": null,      
      "deleted": 0,
      "needForceDirectedLayout": 0,
      "parent": "",
      "sharedDate": 2018-10-24,  
      "commentNotificationType": "nothing",
    }

This endpoint retrieves a specific document by id.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<ID>

URL Parameters

Parameter Description
ID The ID of the document to retrieve

Returns

This returns a JSON object for the document.

Shared Area Folders

Folders can be created for grouping documents shared with you.

List Shared Area Folders

This endpoint retrieves all of your folders. The folders are returned sorted by creation date, with the most recent folder appearing first.

try ( GrafoClient gClient = new GrafoClient(); )
{   
  ResourceSearchCriteria resSearchCrit = 
        new ResourceSearchCriteria().limit(20);
  for (Iterator<Folder> folderIter = gClient.getShareFolders(resSearchCrit); folderIter.hasNext();)
  {
    Folder folder = folderIter.next();
    folder.getId(); folder.getTitle(); folder.getDescription(); 
    folder.getDateCreated();    
    UUID parentFolderId = folder.getParent();  
    UUID owner = doc.getOwner();  
  }
}

//Resource Search Criteria to list documents created on 2018 Oct 17     
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).createdOn(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created before 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).createdBefore(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).createdAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created on or after 2018 Oct 17 
  ResourceSearchCriteria docSearchCrit = 
        new ResourceSearchCriteria().limit(20).createdOnOrAfter(LocalDate.of(2018, 10, 17));

//Resource Search Criteria to list documents created between 2018 Oct 05 and 2018 Oct 17
//(Both dates inclusive)
  ResourceSearchCriteria docSearchCrit = new ResourceSearchCriteria()
                    .createdBetween(LocalDate.of(2018, 10, 05), LocalDate.of(2018, 10, 17), InclusionType.IncludeStartAndEndDate)
                    .limit(20);
# No search criteria. get 1st page and limit to 50
curl https://app.gra.fo/api/v1/sharedWithMeFolders

#List my deleted folders 2nd page and limit 20
curl https://app.gra.fo/api/v1/sharedWithMeFolders?page=2&limit=20

#List Folders created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created=2019-01-23

#List Folders created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[lte]=2019-01-23

#List Folders created before 2019 Jan 23
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[lt]=2019-01-23

#List Folders created after 2017 March 5
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[gt]=2017-03-05

#List Folders created on or after 2017 March 5
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[gte]=2017-03-05

# List Folders created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[gt]=2017-03-05&created[lt]=2019-01-23

# List Folders created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/sharedWithMeFolders?created[gte]=2017-03-05&created[lte]=2019-01-23
//List folders created on 2018 Oct 24 (limit 5, 1st page, without parent folder and not deleted)
var resSearchCriteria = new ResourceSearchCriteria().setLimit(5).setPage(1).setDeleted(false).createdOn('2018-10-24');
var allFolders = await grafoClient.getShareFolders(resSearchCriteria);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "page": "1",
  "folders": [
    {
      "id": "536a35f8-cb7b-41c6-a834-c4c03516657a",
      "title": "inventory_docs",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "dateCreated": 2018-10-24,      
      "parent": "",
      "deleted": null
    },
    {
      "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
      "title": "hr_docs`",
      "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
      "dateCreated": 2018-10-24,      
      "parent": "",
      "deleted": null
    }
  ]
}

HTTP Request

GET http://example.com/api/v1/sharedWithMeFolders

Query Parameters

Common List Paging params of page and limit are supported.

Parameter Child Arguments Default Mandatory Description
parent '' false If set, the folders within another folder whose id is this will be listed.
created false Optional filter on the list based on the created field. Exact check. This (and all child argument) values are in yyyy-MM-dd format
gt false Optional lower bound filter for the created field in list. Excludes the entities created on lower bound itself
gte false Optional lower bound filter for the created field in list. Includes the entities created on lower bound.
lt false Optional upper bound filter for the created field in list. Excludes the entities created on upper bound itself
lte false Optional upper bound filter for the created field in list. Includes the entities created on upper bound.

Returns

This returns a JSON object containing array of folders and the page number. The array contains folders limited by the limit requested (or less if this is the last page), for the current page requested. Each entry in the array is a separate folder object.

Get Shared Area Folder

//Pass the Id of the folder to retrieve
try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = gClient.getShareFolder(UUID.fromString("954423eb-9a36-42d7-b054-7fd1c905d53a"));
  UUID owner = folder.getOwner();
}
curl "https://app.gra.fo/api/v1/shareFolders/954423eb-9a36-42d7-b054-7fd1c905d53a"
//Pass the Id of the folder to retrieve
var folder = await  grafoClient.getShareFolder('536df107-2395-4e7f-9ee7-f177a9b759d6');

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "title": "hr_docs",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24,  
  "parent": "",
  "deleted": 0
}

This endpoint retrieves a specific folder by id.

HTTP Request

GET https://app.gra.fo/api/v1/shareFolders/<ID>

URL Parameters

Parameter Description
ID The ID of the folder to retrieve

Returns

This returns a JSON object for the folder.

Create Folder in Shared Area

//New folder created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = new Folder();
  folder.setTitle("MyFolder_01");
  folder.setParent(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
  Folder folderCreated = gClient.createShareFolder(folder);
}
curl -X POST 
    -d '{"title": "MyFolder_01", "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b"}' 
    https://app.gra.fo/api/v1/shareFolders
//New folder created inside folder with id f16bb076-4fc4-43ab-bddc-e7e6433e497b
Folder folder = new Folder();
  folder.setTitle("MyFolder_01");
  folder.setParent(UUID.fromString("f16bb076-4fc4-43ab-bddc-e7e6433e497b"));
var newFolder = await grafoClient.createShareFolder(folder);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "66aad20f-4ae6-49c9-b4f9-6b6281ec701a",
  "title": "MyFolder_01",
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24, 
  "deleted": null
}

This endpoint creates a folder.

HTTP Request

POST https://app.gra.fo/api/v1/shareFolders

URL Parameters

None

JSON Body

Name Mandatory Default Description
title false "New Folder" Title of the folder
parent false - UUID of parent folder

Returns

This returns a JSON object for the created folder.

Update Folder in Shared Area

try ( GrafoClient gClient = new GrafoClient(); ) {
  Folder folder = 
      gClient.getShareFolder(
        UUID.fromString("66aad20f-4ae6-49c9-b4f9-6b6281ec701a")
      );
  folder.setTitle("NewFolderTitle");
  Folder updatedFolder = gClient.updateShareFolder(folder);
}
curl -X PUT 
    -d '{"title": "NewFolderTitle"}' 
    https://app.gra.fo/api/v1/shareFolders/66aad20f-4ae6-49c9-b4f9-6b6281ec701a
var folder = await  grafoClient.getShareFolder('66aad20f-4ae6-49c9-b4f9-6b6281ec701a');
folder.setTitle("NewFolderTitle");
var updatedFolder = await grafoClient.updateShareFolder(folder);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "66aad20f-4ae6-49c9-b4f9-6b6281ec701a",
  "title": "NewFolderTitle",
  "parent": "f16bb076-4fc4-43ab-bddc-e7e6433e497b",
  "owner": "4aa09898-0348-4a5d-8775-59cadf2d2945",
  "dateCreated": 2018-10-24,  
  "deleted": null
}

This endpoint updates my folder with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/shareFolders/<ID>

URL Parameters

Parameter Description
ID The ID of the folder to retrieve

JSON Body

Name Mandatory Description
title false Title of the folder
parent false UUID of parent folder

Returns

This returns a JSON object for the updated folder.

My Shared Documents

The document can be shared with others by owner of the document or if you have share permissions.

Document Permissions

Document can be shared with following permissions.

Permission Description
view User can only view the shared document
comment User can only comment on the shared document
edit User can only edit the shared document
edit_share User can edit and share the document with others

List Document Shares

This endpoint retrieves information of the document shares by you. The document share information is returned sorted by creation date.

//List document shares for doc ID 78731c17-ed87-4a9d-881a-300c04a1fb6f
try ( GrafoClient gClient = new GrafoClient(); )
{   
  List<DocumentShare> docShares = gClient.getDocumentShares("78731c17-ed87-4a9d-881a-300c04a1fb6f");      
      docShares.forEach(share -> System.out.println(share)) ;
}
curl https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/shares

//List document shares for doc ID 78731c17-ed87-4a9d-881a-300c04a1fb6f
var docShares = await grafoClient.getDocumentShares("78731c17-ed87-4a9d-881a-300c04a1fb6f");

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[ 
    {
      id: '536a35f8-cb7b-41c6-a834-c4c03516657a',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: '519ca7e0-c739-4b9c-9bbf-e1d3097539c0',
      sharedWithEmail: 'testcapsenta7@gmail.com',
      sharedWithFirstName: Jhon,
      sharedWithLastName: Smith,
      permissions: 'view',
      message: "",
      sharedDate: '2018-10-27' 
    },
    {
      id: '47428bfa-5db0-4926-9d60-ebcc80d20ce7',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: 'f16bb076-4fc4-43ab-bddc-e7e6433e497b',
      sharedWithEmail: 'testcapsenta2@gmail.com',
      sharedWithFirstName: Anil,
      sharedWithLastName: Bose,
      permissions: 'comment',
      message: "",
      sharedDate: '2018-10-28' 
    }
  ]

HTTP Request

GET http://example.com/api/v1/documents/<documentId>/shares

URL Parameters

Parameter Description
documentId The ID of the document to retrieve share information

Returns

This returns a JSON object containing array of document share information. Each entry in the array is a separate document share object.

Get Document Share

//Pass the document Id and doc shared Id to retrive doc share information
try ( GrafoClient gClient = new GrafoClient(); ) {
  DocumentShare docShare = gClient.getDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a");    
}
curl "https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/shares/536a35f8-cb7b-41c6-a834-c4c03516657a"
//Pass the document Id and doc shared Id to retrive doc share information
 var docShare = await grafoClient.getDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a");

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    id: '536a35f8-cb7b-41c6-a834-c4c03516657a',
    documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
    owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
    sharedWith: '519ca7e0-c739-4b9c-9bbf-e1d3097539c0',
    sharedWithEmail: 'testcapsenta7@gmail.com',
    sharedWithFirstName: Jhon,
    sharedWithLastName: Smith,
    permissions: 'view',
    message: "",
    sharedDate: '2018-10-27' 
}

This endpoint retrieves a specific document share information by id.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<documetId>/shares/<ID>

URL Parameters

Parameter Description
documentId The ID of the document to retrieve share information
ID The ID of the document share to retrieve

Returns

This returns a JSON object for the document share.

Create Document Share

//Document with Id 78731c17-ed87-4a9d-881a-300c04a1fb6f is shared with user having email testcapsenta2@gmail.com and permissions to only view document
try ( GrafoClient gClient = new GrafoClient(); ) {
 DocumentShare newShare = new DocumentShare();
      newShare.setSharedWithEmail("testcapsenta2@gmail.com");
      newShare.setPermissions(Permission.VIEW);
      newShare.setMessage("Sharing a document");
      shareList = gClient.createDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", newShare);
      shareList.forEach(share -> System.out.println(share)) ;
}
curl -X POST 
    -d '{"sharedWithEmail": "testcapsenta2@gmail.com", "permissions": "view", "message": "Document is shared with you"}' 
    https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/shares
//Document with Id 78731c17-ed87-4a9d-881a-300c04a1fb6f is shared with user having email testcapsenta2@gmail.com and permissions to only view document
var docShare = new DocumentShare();
    docShare.setSharedWithEmail('testcapsenta2@gmail.com');
    docShare.setPermissions(DocPermissions.getDocumentPermissions().VIEW)
    var docShareList = await grafoClient.createDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", docShare);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[ 
    {
      id: '536a35f8-cb7b-41c6-a834-c4c03516657a',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: '519ca7e0-c739-4b9c-9bbf-e1d3097539c0',
      sharedWithEmail: 'testcapsenta7@gmail.com',
      sharedWithFirstName: Jhon,
      sharedWithLastName: Smith,
      permissions: 'view',
      message: "",
      sharedDate: '2018-10-27' 
    },
    {
      id: '47428bfa-5db0-4926-9d60-ebcc80d20ce7',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: 'f16bb076-4fc4-43ab-bddc-e7e6433e497b',
      sharedWithEmail: 'testcapsenta2@gmail.com',
      sharedWithFirstName: Anil,
      sharedWithLastName: Bose,
      permissions: 'comment',
      message: "Document is shared with you",
      sharedDate: '2018-10-28' 
    }
  ]

This endpoint shares a document.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<documentId>/shares

URL Parameters

Parameter Description
documentId The ID of the document to be shared

None

JSON Body

Name Mandatory Default Description
sharedWithEmail true - Email of the user to share the document
permissions true - User permissions when document is shared
message false - Any message for the user while sharing document

Returns

This returns a JSON object for the created document share.

Update Document Share

try ( GrafoClient gClient = new GrafoClient(); ) {
  DocumentShare shareForUpdate = gClient.getDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a"); 
      shareForUpdate.setPermissions(Permission.COMMENT);
      List<DocumentShare> docShare = gClient.updateDocumentShare(shareForUpdate);
}
curl -X PUT 
    -d '{"permissions": "comment"}' 
    https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/shares/536a35f8-cb7b-41c6-a834-c4c03516657a
 var docShare = await grafoClient.getDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a");
    docShare.setPermissions(DocPermissions.getDocumentPermissions().COMMENT)
    var docShareList = await grafoClient.updateDocumentShare(docShare);

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[ 
    {
      id: '536a35f8-cb7b-41c6-a834-c4c03516657a',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: '519ca7e0-c739-4b9c-9bbf-e1d3097539c0',
      sharedWithEmail: 'testcapsenta7@gmail.com',
      sharedWithFirstName: Jhon,
      sharedWithLastName: Smith,
      permissions: 'comment',
      message: "",
      sharedDate: '2018-10-27' 
    },
    {
      id: '47428bfa-5db0-4926-9d60-ebcc80d20ce7',
      documentId: '78731c17-ed87-4a9d-881a-300c04a1fb6f',
      owner: 'f1283a2f-fe25-4538-a8c3-c771b5ea442e',
      sharedWith: 'f16bb076-4fc4-43ab-bddc-e7e6433e497b',
      sharedWithEmail: 'testcapsenta2@gmail.com',
      sharedWithFirstName: Anil,
      sharedWithLastName: Bose,
      permissions: 'comment',
      message: "Document is shared with you",
      sharedDate: '2018-10-28' 
    }
  ]

This endpoint updates document share permissions with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<documetId>/shares/<ID>

URL Parameters

Parameter Description
documentId The ID of the document to retrieve share information
ID The ID of the document share to update

Returns

This returns a JSON object for the document share.

JSON Body

Name Mandatory Description
sharedWithEmail true -
permissions true -

Returns

This returns a JSON object for the updated document share.

Delete Document Share

//Delete doc share with ID 536a35f8-cb7b-41c6-a834-c4c03516657a and document Id 78731c17-ed87-4a9d-881a-300c04a1fb6f 
try ( GrafoClient gClient = new GrafoClient(); ) {
  GenericGrafoResponse resp = gClient.deleteDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a");
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/shares/536a35f8-cb7b-41c6-a834-c4c03516657a
//Delete doc share with ID 536a35f8-cb7b-41c6-a834-c4c03516657a and document Id 78731c17-ed87-4a9d-881a-300c04a1fb6f 
var docShareResp = await grafoClient.deleteDocumentShare("78731c17-ed87-4a9d-881a-300c04a1fb6f", "536a35f8-cb7b-41c6-a834-c4c03516657a");

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes document share for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<documetId>/shares/<ID>

URL Parameters

Parameter Description
documentId The ID of the document to unshare
ID The ID of the document share to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Export API

The Grafo document can be exported to Turtle or Owl formats using the API.

Export to TTL/OWL

This endpoint exports the document to Turtle or Owl formats, as provided by the user in the url parameter.

// not supported
curl https://app.gra.fo/api/v1/documents/78731c17-ed87-4a9d-881a-300c04a1fb6f/type/ttl
//Not supported

The above command returns the turtle exported document

@prefix : <http://www.gra.fo/schema/untitled-ekg#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix gf: <http://www.gra.fo/schema/untitled-ekg#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/spec/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@base <http://www.gra.fo/schema/untitled-ekg#> .

<http://www.gra.fo/schema/untitled-ekg> rdf:type owl:Ontology .

#################################################################
#    Classes
#################################################################

###  http://www.gra.fo/schema/untitled-ekg/NewConcept
<http://www.gra.fo/schema/untitled-ekg/NewConcept> rdf:type owl:Class ;
                                                   rdfs:isDefinedBy <http://www.gra.fo/schema/untitled-ekg> ;
                                                   rdfs:label "New Concept" .


###  http://www.gra.fo/schema/untitled-ekg/Order
<http://www.gra.fo/schema/untitled-ekg/Order> rdf:type owl:Class ;
                                              rdfs:isDefinedBy <http://www.gra.fo/schema/untitled-ekg> ;
                                              rdfs:label "Order" .


#################################################################
#    Annotations
#################################################################

<http://www.gra.fo/schema/untitled-ekg> rdfs:comment "" ;
                                        rdfs:label "Test" .


###  Generated by the OWL API (version 5.1.17) https://github.com/owlcs/owlapi/

HTTP Request

GET https://app.gra.fo/api/v1/documents/<documentId>/type/<outputType>

URL Parameters

Parameter Description
documentId The ID of the document which needs to be exported
outputType The format in which the document should be exported. It can be ttl or owl

Returns

This returns the ttl or owl exported document

EKG Document - Basics

The real world entities and their inter-relations, that are organised in a graph make up the EKG Document. The graph structures use nodes, edges and properties to represent and store data. This, in Grafo is represented as Concepts, Relationships and Attributes.

Concept is the equivalent of vertex in graph parlance. They represented as circles in the EKG Document UI Editor. In EKG they represent a business entity, business concept or a noun.
Each concept is identified by an id beginning with node-

Relationship , as the name suggests gives the inter-relationship between two Concepts. In UI Editor, this is a directed line that connects two nodes.
Each relationship is identified by an id beginning with link-

Specialization is a type of relationship, which depicts mainly a parent-child relationship. In UI Editor, this is represented using dashed line that is directed. The start node from where the line begins is the child and, the end node is the parent.

Attribute is a property that provides additional information or metadata for Concept and Relationship. In UI Editor, the number of attributes in a concept or relationship are displayed at the bottom of respective figures.
Concept Attribute is identified by an id beginning with attr-.
Relationship Attribute is identified by an id beginning with linkattr-

alt text
Figure 1: A simple example of EKG Document containing three concepts, one relationship, one self relationship and one specialization. The numbers at the bottom of concepts and relationships represent the number of attributes.

Fine Grained API

Fine grained API allows one to deal with the constituents of a EkgDocument individually at the network level. This is convenient when individual components are dealt using plain vanilla REST. Javascript API inherently provides the finegrained approach that is also scalable. We recommend using the coarse grained API when dealing via Java etc. as multiple modifications can be aggregated and dispatched to the server at one stretch and the cost of such operation is linear along with a fixed offset base cost. REST API or fine grained API in Java has the fixed offset cost overhead for each fine grained call making it less efficient.

Coarse Grained API

Coarse grained approach provides the functionality of aggregating all the operations required to be carried out in an EKG Document. Using this approach, one can create, update or delete the elements of an EKG document in one go. This makes a single call to the server and the cost of such operation is linear in comparison to fine grained approach.

Coarse grained approach is recommended when multiple operations are expected to be carried out on an EKG document. Fine grained approach can be used for minor additions, updations or deletions.

EKG Document - Coarse Grained Operations

full image Figure 1: UML Class Diagram for EKG Document

Following operations are supported

Get EKG Document

This endpoint retrieves all the contents of an ekg document. The information includes document details, list of concepts and relationships along with their attributes and fields.

try (GrafoClient gClient = new GrafoClient();){ 
    UUID docId = UUID.fromString("c7712dfe-b287-498d-a80d-1b09a9edc49a");
    EkgDocument ekgDoc = gClient.getEkgDocument(docId);
    System.out.println(ekgDoc);
}
curl "https://app.gra.fo/api/v1/documents/c7712dfe-b287-498d-a80d-1b09a9edc49a/ekg
var demoDocFetch = async function() {
    try {
        //After initial authentication..
        //Refer Section on Authentication
        var docDetails = await grafoClient.getDocument("c7712dfe-b287-498d-a80d-1b09a9edc49a");
        var ekgDoc = await grafoClient.getEkgDocument(docDetails);
        console.log(ekgDoc);
    } catch(err) {
        console.log(err);
    } 
};

The above command returns JSON whose high level structure is like this:

{
  "id": "c7712dfe-b287-498d-a80d-1b09a9edc49a",
  "type": "document",
  "title": "Untitled Document",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "f76351f3-be89-485c-a851-19508a03bbf7",
  "dateCreated": 1542785023,
  "dateDeleted": null,
  "lastModified": 1542785023,
  "deleted": false,
  "parent": "",
  "concepts": {
    "node-82e0ae9f-9d00-4eee-854c-ccd8f0e0aa37": {
      "id": "node-82e0ae9f-9d00-4eee-854c-ccd8f0e0aa37",
      "type": "concept",
      "label": "B",
      .....
      "fields": [],
      "attrGroup": {}
    },
    "node-8bc45fd1-2a6a-4ca7-9dec-e11bde2ce1e9": {},
    "node-5b3d147e-64d5-45d1-bf0e-e6cccbd03b44": {}
  },
  "relationships": {
    "link-422e39f0-b58d-4d79-9490-4b59207fcf2d": {
      "id": "link-422e39f0-b58d-4d79-9490-4b59207fcf2d",
      "type": "link",
      .....
      "fields": [],
      "attrGroup": {}
    },
    "link-84309463-f4f6-401c-b6b4-b8891f1196bd": {},
    "link-51b11a09-67d0-4e9a-9898-82d5c1e28fe1": {}
  }
}

Each Concept in the above json is like this:

{
  "id": "node-82e0ae9f-9d00-4eee-854c-ccd8f0e0aa37",
  "type": "concept",
  "label": "B",
  "description": "",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg/B",
  "positionX": 144,
  "positionY": 137,
  "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7",
  "fields": [
    {
      "id": "4293c8fb-7f66-4ae8-be32-88b253fa1716",
      "title": "FieldB1",
      "text": "Value1"
    }
  ],
  "attrGroup": {
    "id": "attrGrp-eef1c554-0395-4c0c-95d2-d05f193e1fb0",
    "attributes": [
      {
        "id": "attr-0de2fd7a-6c6e-4d29-8a80-3652ece36a05",
        "type": "attribute",
        "label": "attribute1",
        "description": "",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg/attribute1_attr-0de2fd7a-6c6e-4d29-8a80-3652ece36a05",
        "xsdDataType": null,
        "fields": [
          {
            "id": "f1346aac-3615-4735-a39f-1d0be4b0b375",
            "title": "Field1",
            "text": "Value1"
          }
        ]
      }
    ],
  }
  "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7"
}

Each Relationship in the above json is like this:

{
  "id": "link-422e39f0-b58d-4d79-9490-4b59207fcf2d",
  "type": "link",
  "fromConceptId": "node-8bc45fd1-2a6a-4ca7-9dec-e11bde2ce1e9",
  "toConceptId": "node-8bc45fd1-2a6a-4ca7-9dec-e11bde2ce1e9",
  "label": "selfLink1",
  "description": "",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg/selflink1",
  "cardinalityType": null,
  "cardinality": null,
  "specialization": false,
  "positionX": 9,
  "positionY": -186,
  "deleted": false,
  "fields": [],
  "attrGroup": {
  "id": "attrGrp-f657c603-0170-400c-9e87-388d67e7aa90",
  "attributes": [
    {
      "id": "linkattr-835e049c-3d65-4e47-be50-857198318c25",
      "type": "attribute",
      "label": "relattribute1",
      "description": "",
      "iri": "http://www.app.gra.fo/schema/untitled-ekg/relattribute1_linkattr-835e049c-3d65-4e47-be50-857198318c25",
      "xsdDataType": null,
      "fields": [
          {
            "id": "f1346aac-3615-4735-a39f-1d0be4b0b375",
            "title": "Field1",
            "text": "Value1"
          }
      ]
    }
  ],
  "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7"
}

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/ekg

URL Parameters

Parameter Description
docId The ID of the ekg doc to be retrieved

Returns

This returns a JSON object for the ekg document.

EKG Document Properties Description
id Document Identifier
type This is always document
title Document Name. Default Value is "Untitled Document"
description Optional description
iri Document Identifier in URI format. Default value is "http://www.app.gra.fo/schema/untitled-ekg"
owner The user identifier who created the document
dateCreated It is the date when document was created. It is in UNIX timestamp format
dateDeleted It is the date when document was deleted. In UNIX timestamp format
lastModified The user identifier who modified the document
deleted A boolean value to know if a document is deleted or not
parent This depicts the folder in which the document resides
concepts A map of all the concepts available in the ekg document. Its properties are given below
relationships A map of all the relationships available in the ekg document. Its properties are given below
Concept Properties Description
id Concept Identifier (beginning with a node-)
type This is always concept
label Concept Name is a required property.
description Optional Description
iri Concept Identifier in URI format
fields array of Field objects
attrGroup object containing an array of Attribute objects. The properties of an attribute are listed below
Relationship Properties Description
id Relationship Identifier (beginning with a link-)
type This is always link.
label Relationship Name is a required property
description Optional Description
iri Relationship Identifier in URI format
fields array of Field objects
fromConceptId The identifier of the concept from where the relationship originates
toConceptId The identifier of the concept where the relationship points
cardinality Type It can be null, max, min or exact
cardinality It is the cardinality value
specialization Boolean value
attrGroup object containing an array of Attribute objects. The properties of an attribute are listed below
Attribute Properties Description
id Attribute Identifier (beginning with a attr- for concept and linkattr- for relationship)
type This is always attribute
label Attribute Name is a required property
description Optional Description
iri Attribute Identifier in URI format
fields array of Field objects
xsdDataType xsd data type
cardinalityType cardinality Type
cardinality cardinality value
Field Properties Description
id Field identifier
title The name of the field
text The value of the field

Create EKG Document

try 
    (
      GrafoClient gClient = new GrafoClient();
    )
    { 
      EkgDocument ekgDoc = new EkgDocument();
      ekgDoc.setTitle("My Test Doc " + System.currentTimeMillis());
      Concept c1 = new Concept("A");
      c1.setPositionX(200);
      c1.setPositionY(300);
      c1.addField(new Field("FieldA1"));
      ekgDoc.addNewConcept(c1);   

      Concept c2 = new Concept("B");
      Field field1 = new Field("FieldB1");
      field1.setText("ValueB1");
      c2.addField(field1);
      Attribute attr1 = new Attribute("AttributeTest1");
      Attribute attr2 = new Attribute("AttributeTest2");
      c2.addAttribute(attr1);
      c2.addAttribute(attr2);
      Field attrField1 = new Field("FieldBAttr1");
      Field attrField2 = new Field("FieldBAttr2");
      attrField2.setText("ValueB2");
      attr2.addField(attrField1);
      attr2.addField(attrField2);
      ekgDoc.addNewConcept(c2);

      Relationship r1 = new Relationship(c1, c2, "peerlink", RelationshipType.PEER);
      r1.setCardinality(Integer.toString(100));
      r1.setCardinalityType(CardinalityType.EXACT);
      ekgDoc.addNewRelationship(r1);

      Relationship r2 = new Relationship(c1, "selflink");
      ekgDoc.addNewRelationship(r2);      

      EkgDocument ekgDocAdded = gClient.addEkgDocument(ekgDoc);
      System.out.println(ekgDocAdded);
curl -X POST 
    -d <data> 
    https://app.gra.fo/api/v1/documents/ekg
#The output displayed below can be sent as data to the above command
#Read the documentation for more info
var demoDocCreate = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication
      var docDetails =  await grafoClient.createDocument('', docName);
      var ekgDoc = await grafoClient.createEkgDocument(docDetails);

      //After creating empty ekg document from above command
      //fine-grained operations have to be invoked to add elements
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "446f86c7-2f0f-4fe7-9bea-c778e469b914",
  "type": "document",
  "title": "Test Document",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "f76351f3-be89-485c-a851-19508a03bbf7",
  "parent": null,
  "concepts": {
    "node-926593ff-a5bf-4809-8a47-8b50affba939": {
    "id": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "type": "concept",
    "label": "A",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-926593ff-a5bf-4809-8a47-8b50affba939_A",
    "positionX": 200,
    "positionY": 300,
    "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7",
    "fields": [
      {
        "id": "99a20fc6-19d6-4882-8ae9-300016664e7d",
        "title": "FieldA1"
      }]
    },
  "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4": {
    "id": "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4",
    "type": "concept",
    "label": "B",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4_B",
    "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7",
    "fields": [
      {
        "id": "a49c5a14-e299-4fa3-a606-a60748831153",
        "title": "FieldB1",
        "text": "ValueB1"
      }]
    }
  },
  "relationships": {
    "link-b4bbb7e8-4187-4049-b632-e87624ecf4aa": {
    "id": "link-b4bbb7e8-4187-4049-b632-e87624ecf4aa",
    "type": "link",
    "fromConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "toConceptId": "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4",
    "label": "peerlink",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#link-b4bbb7e8-4187-4049-b632-e87624ecf4aa_peerlink",
    "cardinalityType": {
      "id": 2,
      "title": "exact"
      },
    "cardinality": "100",
    "specialization": false,
    "positionX": null,
    "positionY": null,
    "deleted": false,
    "fields": []
  },
  "link-f1a82217-1471-4a9e-80dc-659979219590": {
    "id": "link-f1a82217-1471-4a9e-80dc-659979219590",
    "type": "link",
    "fromConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "toConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "label": "selflink",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#link-f1a82217-1471-4a9e-80dc-659979219590_selflink",
    "cardinalityType": null,
    "specialization": false,
    "positionX": 100,
    "positionY": 173,
    "deleted": false,
    "fields": []
    }
  }
}

When this endpoint is invoked, it creates all the concepts, relationships, their attributes and fields provided in the input.

HTTP Request

POST https://app.gra.fo/api/v1/documents/ekg

Returns

This returns a JSON object for the created ekg document. The returned ekg document contains document id, timestamp of document created, the user identifier who created the document, the user identifier of the one who modified the document.

Update EKG Document

try 
    (
      GrafoClient gClient = new GrafoClient();
    )
    { 
      UUID docId = UUID.fromString("446f86c7-2f0f-4fe7-9bea-c778e469b914");
      EkgDocument ekgDoc = gClient.getEkgDocument(docId);
      ekgDoc.setTitle("Updated Document");
      Concept conceptForUpdate = ekgDoc.getConcept("node-926593ff-a5bf-4809-8a47-8b50affba939");
      Field field1 = new Field("Test2");
      field1.setText("Value2");
      conceptForUpdate.addField(field1);
      conceptForUpdate.setIri("www.abc.com/schema/ModifiedIritest1");
      conceptForUpdate.setColor(Color.LIGHT_GREY);
      EkgDocument ekgDocAdded = gClient.updateEkgDocument(ekgDoc);
      System.out.println(ekgDocAdded);
    } 
curl -X PUT 
    -d '{
      "title": "Updated Document", 
      "concepts": {
        "node-926593ff-a5bf-4809-8a47-8b50affba939" : {
        "id" : "node-926593ff-a5bf-4809-8a47-8b50affba939",
        "entityState":2,
        "fields":[{
          "title":"Test2",
          "text":"Value2",
          "entityState":1
        }],
        "iri":"www.abc.com/schema/ModifiedIritest1",
        "color":"#d4d4d4"
      }}}' 
    https://app.gra.fo/api/v1/documents/446f86c7-2f0f-4fe7-9bea-c778e469b914/ekg
//Not supported

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "446f86c7-2f0f-4fe7-9bea-c778e469b914",
  "type": "document",
  "title": "Updated Document",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg",
  "iriPrefix": "gf",
  "description": "",
  "owner": "f76351f3-be89-485c-a851-19508a03bbf7",
  "parent": null,
  "concepts": {
    "node-926593ff-a5bf-4809-8a47-8b50affba939": {
    "id": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "type": "concept",
    "label": "A",
    "description": "",
    "color":"#d4d4d4"
    "iri":"www.abc.com/schema/ModifiedIritest1",
    "positionX": 200,
    "positionY": 300,
    "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7",
    "fields": [
      {
        "id": "99a20fc6-19d6-4882-8ae9-300016664e7d",
        "title": "FieldA1"
      },
      {
        "title":"Test2",
        "text":"Value2",
      }]
    },
  "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4": {
    "id": "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4",
    "type": "concept",
    "label": "B",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4_B",
    "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7",
    "fields": [
      {
        "id": "a49c5a14-e299-4fa3-a606-a60748831153",
        "title": "FieldB1",
        "text": "ValueB1"
      }]
    }
  },
  "relationships": {
    "link-b4bbb7e8-4187-4049-b632-e87624ecf4aa": {
    "id": "link-b4bbb7e8-4187-4049-b632-e87624ecf4aa",
    "type": "link",
    "fromConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "toConceptId": "node-03d74c0b-8a01-4456-a100-9eeadbc2f4b4",
    "label": "peerlink",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#link-b4bbb7e8-4187-4049-b632-e87624ecf4aa_peerlink",
    "cardinalityType": {
      "id": 2,
      "title": "exact"
      },
    "cardinality": "100",
    "specialization": false,
    "positionX": null,
    "positionY": null,
    "deleted": false,
    "fields": []
  },
  "link-f1a82217-1471-4a9e-80dc-659979219590": {
    "id": "link-f1a82217-1471-4a9e-80dc-659979219590",
    "type": "link",
    "fromConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "toConceptId": "node-926593ff-a5bf-4809-8a47-8b50affba939",
    "label": "selflink",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#link-f1a82217-1471-4a9e-80dc-659979219590_selflink",
    "cardinalityType": null,
    "specialization": false,
    "positionX": 100,
    "positionY": 173,
    "deleted": false,
    "fields": []
    }
  }
}

This endpoint encompasses multiple functionalities of create, update and delete elements in the EKG document. The decision to create, update or delete is made based on the Entity State passed with the element in json.

In Java, the entity state is intelligently calculated and only the deltas are passed to the server. In Shell, one has to provide the Entity State value along with the json as shown in the example. This functionality is not supported in Javascript.

When this endpoint is invoked it updates the document according to the data provided by the user and then it goes on to create, update or delete, concepts, relationships, attributes and fields based on the Entity State of that element.

Entity State Value
Unchanged 0
New 1
Updated 2
Deleted 3

The Entity States New and Updated are optional. The operation will be deduced from the provided input data. If the element already exists it will be updated, otherwise it will be created. However for Delete, one has to provide the Entity State.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/ekg

Returns

This returns a JSON object for the updated ekg document. The returned ekg document contains document id, timestamp of document created, the user identifier who created the document, the user identifier of the one who modified the document.

Delete EKG Document

try 
    (GrafoClient gClient = new GrafoClient();)
    { 
      UUID docId = UUID.fromString("446f86c7-2f0f-4fe7-9bea-c778e469b914");
      GenericGrafoResponse response = gClient.deleteEkgDocument(docId);
    } 
curl -X DELETE
    https://app.gra.fo/api/v1/documents/446f86c7-2f0f-4fe7-9bea-c778e469b914
var demoDocDelete = async function() {
    try {
        //After initial authentication..
        //Refer Section on Authentication
        await grafoClient.deleteEkgDocument("446f86c7-2f0f-4fe7-9bea-c778e469b914");
    } catch(err) {
        console.log(err);
    } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success" : "true"
}

When this endpoint is invoked it marks the document as deleted in database.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Concepts

Concept is the equivalent of vertex in graph parlance. They represented as circles in the EKG Document UI Editor. In EKG they represent a business entity, business concept or a noun.

Each concept is identified with an id beginning with node-

All concept endpoints are fine grained network operations. You can achieve all of these operations at one go using the coarse grained operations on the EkgDocument.

List Concepts

This endpoint retrieves all of your concepts within a ekg document. As the concepts are part of a graph, only the natural order of concepts is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...;
    List<Concept> conceptList = gClient.getAllConcepts(docId));
    conceptList.forEach( concept -> System.out.println(concept));
}
# Get all concepts for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts
var demoListAllConcept = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      var conceptList = await ekgDoc.getConcepts();
      console.log(conceptList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
  {
    "id": "node-abf58752-2e44-45e7-8653-ed648481f03a",
    "type": "concept",
    "label": "Concept1",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-abf58752-2e44-45e7-8653-ed648481f03a_Concept1"
  },
  {
    "id": "node-8a21c773-380f-4db9-92a6-f4984efd37ad",
    "type": "concept",
    "label": "Concept2",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-8a21c773-380f-4db9-92a6-f4984efd37ad_Concept2",
    "fields": [
      {
        "id": "c144fb7b-787c-4422-8f63-d8feff2b1e25",
        "title": "SampleConceptField"
      }
    ],
    "attrGroup": {
      "id": "attrGrp-0a9681a1-cac1-4547-8b50-e06421b1778e",
      "attributes": [
        {
          "id": "attr-db27bce1-967c-4966-8ff7-b21ab970d1e6",
          "type": "attribute",
          "label": "SampleConceptAttrib",
          "description": "",
          "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-db27bce1-967c-4966-8ff7-b21ab970d1e6_SampleConceptAttrib"
        }
      ]
    }
  }
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved

Returns

This returns an array of all concepts for the specified doc id. Each entry in the array is a separate concept object.

Concept Properties Description
id Concept Identifier (beginning with a node-)
type This is always concept
label Concept Name (always present). Default Value New Concept
description Optional Description
iri Concept Identifier in URI format
fields array of Field objects
attrGroup object containing an array of Attributes objects

Get Concept

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  Concept concept = gClient.getConcept(docId, 
                         "node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  String iri = concept.Iri();
  String label = concept.getLabel();
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad"
var demoGetConcept = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: ConceptId
      **********************/
     var fetchedConcept = ekgDoc.getConcept("node-8a21c773-380f-4db9-92a6-f4984efd37ad");
    console.log(fetchedConcept.toObject());
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "node-8a21c773-380f-4db9-92a6-f4984efd37ad",
    "type": "concept",
    "label": "Concept2",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-8a21c773-380f-4db9-92a6-f4984efd37ad_Concept2",
    "fields": [
      {
        "id": "c144fb7b-787c-4422-8f63-d8feff2b1e25",
        "title": "SampleConceptField"
      }
    ],
    "attrGroup": {
      "id": "attrGrp-0a9681a1-cac1-4547-8b50-e06421b1778e",
      "attributes": [
        {
          "id": "attr-db27bce1-967c-4966-8ff7-b21ab970d1e6",
          "type": "attribute",
          "label": "SampleConceptAttrib",
          "description": "",
          "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-db27bce1-967c-4966-8ff7-b21ab970d1e6_SampleConceptAttrib"
        }
      ]
    }
}

This endpoint retrieves a specific concept by id within a ekg document with specified docid.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<ID>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
ID The ID of the concept to retrieve

Returns

This returns a JSON object for the concept.

Create Concept

try ( GrafoClient gClient = new GrafoClient(); ) {
  Concept concept = new Concept();
  concept.setLabel("Concept3");
  concept.setDescription("Sample description");
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  Concept conceptCreated = gClient.createConcept(docId, concept);
}
curl -X POST 
    -d '{"label": "Concept3", "description": "Sample Description"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts
var demoCreateConcept = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Create or Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order:
      Label, PositionX, PositionY, Description, Color, Fields, Iri
      **********************/
      var conceptCreated = await ekgDoc.addConcept("Concept3", null, null, "Sample Description");
      console.log(conceptCreated);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "node-7bec685e-6330-4add-ab32-a31edab215f3",
  "type": "concept"
  "label": "Concept3",
  "description": "Sample Description",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-7bec685e-6330-4add-ab32-a31edab215f3_Concept3"
}

This endpoint creates a concept within the specified ekg document.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/concepts

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved

JSON Body

Name Mandatory Default Description
label true "New Concept" Concept Label
description false "" Concept description
iri false Concept IRI. A value is auto assigned by Grafo Server if not specified in create request
positionX false X coordinate in UI
positionY false Y coordinate in UI
color false #AACCFF Hex code of the RGB values. List of colors that can be used is provided below.

Color List

Name Hex Code
AMBER_YELLOW #fdc344
LEMON_YELLOW #e2fd24
GREEN #5ff263
CYAN #6FF2CD
PASTEL_BLUE #AACCFF
SKY_BLUE #50A4FD
STEEL_BLUE #717CFD
VIOLET #C88DEF
CORAL_RED #ED5C5C
ORANGE #ea874d
BROWN #ccb487
LIGHT_GREY #d4d4d4

Returns

This returns a JSON object for the created concept. The returned concept contains id and iri assigned.

Update Concept

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  Concept concept = gClient.getConcept(docId, 
                         "node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  concept.setLabel("UpdateConceptLbl");
  concept.setPositionY(90);
  Concept updatedConcept = gClient.updateConcept(docId, concept);
}
curl -X POST 
    -d '{"label": "UpdateConceptLbl", "positionY": 90}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad
var demoUpdateConcept = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order:
      Label, PositionX, PositionY, Description, Color, Fields, reserved placeholder which is null, Iri, ConceptId
      **********************/
      var updatedConcept = await ekgDoc.updateConcept("UpdateConceptLbl", null, "90", null, null, null, null, null,"node-8a21c773-380f-4db9-92a6-f4984efd37ad");
      console.log(updatedConcept);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "node-8a21c773-380f-4db9-92a6-f4984efd37ad",
  "type": "concept"
  "label": "UpdateConceptLbl",
  "description": "Sample Description",
  "positionX": 90,
  "iri": "http://www.app.gra.fo/schema/untitled-ekg#node-7bec685e-6330-4add-ab32-a31edab215f3_Concept3"
}

This endpoint updates my concept with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/concepts/<ID>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
ID The ID of the concept to update

JSON Body

Name Description
label Concept Label
description Concept description
iri Concept IRI
positionX X coordinate in UI
positionY Y coordinate in UI
color Hex code of the RGB values. List of colors that can be used is provided below.

Color List

Name Hex Code
AMBER_YELLOW #fdc344
LEMON_YELLOW #e2fd24
GREEN #5ff263
CYAN #6FF2CD
PASTEL_BLUE #AACCFF
SKY_BLUE #50A4FD
STEEL_BLUE #717CFD
VIOLET #C88DEF
CORAL_RED #ED5C5C
ORANGE #ea874d
BROWN #ccb487
LIGHT_GREY #d4d4d4

Returns

This returns a JSON object for the updated concept.

Delete Concept

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "node-8a21c773-380f-4db9-92a6-f4984efd37ad";
  GenericGrafoResponse response = gClient.deleteConcept(docId, conceptId));
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad
var demoDeleteConcept = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: ConceptId
      **********************/
     await ekgDoc.deleteConcept("node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes my concept for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/concepts/<ID>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
ID The ID of the concept to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Concept Attributes

The term attribute refers to a feature that is part of a concept or relationship. It is a property that has a name, data type and cardinality.

Concept attribute is identified with an id beginning with attr-

All concept attribute endpoints are fine grained network operations. You can achieve all of these operations at one go using the coarse grained operations on the EkgDocument.

List Concept Attributes

This endpoint retrieves all the attributes for a concept within a ekg document. Natural order of attributes is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; Sring conceptId = "...";
    List<Attribute> attribList = gClient.getAllConceptAttributes(
        docId, conceptId);
    attribList.forEach( attrib -> System.out.println(attrib));
}
# Get all attributes for doc and concept
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-5baeadf9-24e0-4776-b2e9-75ef535ef88c/attributes
var demoListAllConceptAttributes = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: ConceptId
      **********************/
     var attributeList = await ekgDoc.getConceptAttributes("node-5baeadf9-24e0-4776-b2e9-75ef535ef88c");
    console.log(attributeList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "attr-6b945e31-759c-4b5e-b251-3b5a586d4d59",
        "type": "attribute",
        "label": "Attrib2",
        "description": "",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-6b945e31-759c-4b5e-b251-3b5a586d4d59_Attrib2"
        "fields": [
          {
            "id": "c144fb7b-787c-4422-8f63-d8feff2b1e25",
            "title": "SampleConceptAttribField"
          }
        ],
       "xsdDataType": { "id": 1, "title": "string"},
       "cardinalityType": { "id": 1, "title": "max"},
       "cardinality": "10"
    },
    ...
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the concept belongs
conceptId The Id of concept of which the attributes are retrieved

Returns

This returns an array of all attributes for the specified doc id and concept id. Each entry in the array is a separate attribute object. Attribute Properties are defined in the section titled EKG Document Coarse Grained Operations

Get Concept Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "..."; String attrId = "...";
  Attribute attr = gClient.getConceptAttribute(docId, conceptId, attrId);
  String iri = attr.Iri();
  String label = attr.getLabel();
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/attr-6b945e31-759c-4b5e-b251-3b5a586d4d59"
var demoGetConceptAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in order: ConceptId, AttributeId
      **********************/
      var fetchedAttrib = ekgDoc.getConceptAttribute("node-8a21c773-380f-4db9-92a6-f4984efd37ad", "attr-6b945e31-759c-4b5e-b251-3b5a586d4d59");
      console.log(fetchedAttrib.toObject());
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "attr-6b945e31-759c-4b5e-b251-3b5a586d4d59",
    "type": "attribute",
    "label": "Attrib2",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-6b945e31-759c-4b5e-b251-3b5a586d4d59_Attrib2"
    "fields": [
      {
        "id": "c144fb7b-787c-4422-8f63-d8feff2b1e25",
        "title": "SampleConceptAttribField"
      }
    ]
}

This endpoint retrieves a specific concept attribute by id within a ekg document with specified docid and for a specific conceptid.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId ID of the concept
attribId The ID of the attribute to retrieve

Returns

This returns a JSON object for the attribute.

Create Concept Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  Attribute attrib = new Attribute();
  attrib.setLabel("MyAttrib_03");
  attrib.setDescription("Sample description");
  attrib.setXsdDataType(XsdDataType.DATETIME);
  attrib.setCardinalityType(CardinalityType.MIN);
  attrib.setCardinlaity("3");

  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "..."
  Attribute attrCreated = gClient.createConceptAttribute(docId, conceptId, attrib);
}
curl -X POST 
    -d '{"label": "MyAttrib_03", "description": "Sample Description", "cardinalityType": { "id": 1, "title": "max"}, "cardinality":"3"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes
var demoCreateConceptAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Label, Description, Fields, XsdDataType, CardinalityType, Cardinality, Iri, Id, ConceptId
      **********************/
      await ekgDoc.addAttributeToConcept("MyAttrib_03", "Sample Description", null, null, "max", "3", null, null, conceptId);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1",
  "type": "attribute"
  "label": "MyAttrib_03",
  "description": "Sample Description",
  "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-9aaf949e-d4d4-4749-b561-9a762757a1d1_MyAttrib_03",
  "cardinalityType": {"id": 0, "title": "min"},
  "cardinality": "3"
}

This endpoint creates a attribute within the specified ekg document and concept.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId The concept id for which the attribute is created

JSON Body

Name Mandatory Default Description
label true -- Concept Attribute Label
description false "" Concept Attribute description
iri false Concept Attribute IRI. A value is auto assigned by Grafo Server if not specified in create request
fields false empty array of Field objects
xsdDataType false xsd data type
cardinalityType false cardinality Type
cardinality false cardinality value

Returns

This returns a JSON object for the created concept attribute. The returned concept attribute contains id and iri assigned.

Update Concept Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  Concept concept = gClient.getConcept(docId, 
                         "node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  List<Attribute> attribList = concept.getAttributes();
  Attribute attrib = attribList.get(1); //assuming there are atleast 2
  attrib.setLabel("UpdateAttribLbl");
  attrib.setXsdDataType(XsdDataType.DECIMAL);
  attrib.setCardinalityType(CardinalityType.EXACT);
  attrib.setCardinlaity("20");
  Attribute updatedAttr = 
        gClient.updateConceptAttribute(docId, conceptId, attrib);
}
curl -X POST 
    -d '{"label": "UpdateAttribLbl", "cardinality": "20", "cardinalityType": { "id": 1, "title": "min"} }' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/attr-33c6ed7b-8437-41ce-9552-9caed3f242b9
var demoUpdateConceptAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Label, Description, Fields, reserved placeholder which is null, XsdDataType, CardinalityType, Cardinality, Iri, Id, ConceptId
      **********************/
      await ekgDoc.updateAttributeToConcept("UpdateAttribLbl", "", null, null, null, "min", "20", null, "attr-33c6ed7b-8437-41ce-9552-9caed3f242b9", "node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "id": "attr-33c6ed7b-8437-41ce-9552-9caed3f242b9",
  "type": "attribute"
  "label": "UpdateAttribLbl",
  "cardinality": "20", 
  "cardinalityType": { "id": 1, "title": "min"},
  "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-33c6ed7b-8437-41ce-9552-9caed3f242b9_UpdateAttribLbl"
}

This endpoint updates attribute with the specified attribute id within the specified concept and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept and attributes are retrieved
conceptId The ID of the concept
attribId Id of attribute to update

JSON Body

Name Mandatory Default Description
label false -- Concept Attribute Label
description false "" Concept description
iri false Concept Attribute IRI. A value is auto assigned by Grafo Server if not specified in create request
fields false empty array of Field objects
xsdDataType false xsd data type
cardinalityType false cardinality Type
cardinality false cardinality value

Returns

This returns a JSON object for the updated attribute.

Delete Concept Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "node-8a21c773-380f-4db9-92a6-f4984efd37ad";
  String attribId = "";
  GenericGrafoResponse response = gClient.deleteConceptAttribute(docId, conceptId, attribId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/attr-33c6ed7b-8437-41ce-9552-9caed3f242b9
var demoDeleteConceptAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: ConceptId, AttributeId
      **********************/
      await ekgDoc.deleteConceptAttribute("node-8a21c773-380f-4db9-92a6-f4984efd37ad", "attr-33c6ed7b-8437-41ce-9552-9caed3f242b9");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the concept attribute for the specified id present within the selected concept in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId The ID of the concept of which attribute to delete
attribId The ID of the attribute to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Relationships

Relationship is the equivalent of an edge in graph. It is a directed line that connects two nodes. It represents inter-relationship between two Concepts. There are possibilities that a relationship starts and ends at the same node. This is also supported.

Each relationship is identified by an id beginning with link-

All relationship endpoints are fine grained network operations. You can achieve all of these operations at one go using the coarse grained operations on the EkgDocument.

List Relationships

This endpoint retrieves all the relationships within an EKG document. As the relationships are part of a graph, only the natural order of relationships is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try (GrafoClient gClient = new GrafoClient();) {
    List<Relationship> relList = gClient.getAllRelationships(UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a"));
    relList.forEach( rel -> System.out.println(rel));
}
# Get all relationships for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships
var demoListAllRelationships = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      var relList = await ekgDoc.getRelationships();
      console.log(relList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "link-2e2069ba-3523-4731-8c41-35189796f7dd",
        "type": "link",
        "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
        "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
        "label": "linkAtoB1",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg/linkatob1",
        "cardinalityType": {
            "id": 2,
            "title": "exact"
        },
        "cardinality": "10",
        "fields": [
        {
            "id": "8d308e21-fc40-403f-b667-2de545219d4a",
            "title": "Sample Field",
            "text": "Test Value"
        }
        ],
        "attrGroup": {
            "id": "attrGrp-6b610b09-701a-4b5b-9138-8eeae407ac50",
            "attributes": [
            {
                "id": "linkattr-f132601f-34ee-4c8a-8486-b83c867174f7",
                "type": "attribute",
                "label": "relattribute1",
                "description": "",
                "iri": "http://www.app.gra.fo/schema/untitled-ekg/relattribute1_linkattr-f132601f-34ee-4c8a-8486-b83c867174f7",
                "fields": []
            }],
            "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7"
        }
    },
        {
        "id": "link-113ae2a0-d7de-466b-b552-8da441ecb2e9",
        "type": "link",
        "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
        "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
        "label": "linkAtoB2",
        "description": "",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg/linkatob2",
    }
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved

Returns

This returns an array of all relationships for the specified doc id. Each entry in the array is a separate relationship object.

Relationship Properties are defined in the section titled EKG Document - Coarse Grained Operations

Get Relationship

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    Relationship rel = gClient.getRelationship(docId, "link-2e2069ba-3523-4731-8c41-35189796f7dd");
    System.out.println(rel)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd"
var demoGetRelationship = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: RelationshipId
      **********************/
     var fetchedRel = ekgDoc.getRelationship("link-2e2069ba-3523-4731-8c41-35189796f7dd");
    console.log(fetchedRel.toObject());
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "link-2e2069ba-3523-4731-8c41-35189796f7dd",
    "type": "link",
    "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
    "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
    "label": "linkAtoB1",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg/linkatob1",
    "cardinalityType": {
        "id": 2,
        "title": "exact"
    },
    "cardinality": "10",
    "fields": [
    {
        "id": "8d308e21-fc40-403f-b667-2de545219d4a",
        "title": "Sample Field",
        "text": "Test Value"
    }],
    "attrGroup": {
        "id": "attrGrp-6b610b09-701a-4b5b-9138-8eeae407ac50",
        "attributes": [
        {
            "id": "linkattr-f132601f-34ee-4c8a-8486-b83c867174f7",
            "type": "attribute",
            "label": "relattribute1",
            "description": "",
            "iri": "http://www.app.gra.fo/schema/untitled-ekg/relattribute1_linkattr-f132601f-34ee-4c8a-8486-b83c867174f7",
            "fields": []
        }],
        "lastUpdatedBy": "f76351f3-be89-485c-a851-19508a03bbf7"
    }
}

This endpoint retrieves a specific relationship by id within a ekg document with specified docid.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<id>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
id The ID of the relationship to retrieve

Returns

This returns a JSON object for the relationship.

Create Relationship

try (GrafoClient gClient = new GrafoClient();) {
    //concept1 and concept2 are start and end nodes of a relationship
    Relationship relationship = new Relationship(concept1, concept2, "link1to2", RelationshipType.PEER);
    relationship.setDescription("Demo Add Relationship");
    Relationship newRelationship = gClient.createRelationship(UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a"), relationship);
    System.out.println(newRelationship);
}
curl -X POST 
    -d '{"label": "link1to2", "description": "Demo Add Relationship",
"fromConceptId":"node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
"toConceptId":"node-74232afd-fd3b-4006-99d0-5487c23d83d5"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships
var demoCreateRelationship = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Create or Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order:
      Label, FromConceptId, ToConceptId, Specialization, Description, Color, Fields, CardinalityType, Cardinality, PositionX, PositionY, Iri
      **********************/
      var relCreated = await ekgDoc.addRelationship("link1to2", "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91", "node-74232afd-fd3b-4006-99d0-5487c23d83d5", null, "Demo Add Relationship");
      console.log(relCreated);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "link-245ae2a0-d7de-466b-b552-8da441ecb2e9",
    "type": "link",
    "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
    "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
    "label": "link1to2",
    "description": "Demo Add Relationship",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg/linkatob2",
    "cardinalityType": null,
    "cardinality": null,
    "positionX": null,
    "positionY": null
}

This endpoint creates a relationship within the specified ekg document.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/relationships

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved

JSON Body

Name Mandatory Default Description
label true Relationship Label
fromConceptId true Id of the start node
toConceptId true Id of the end node
description false "" Relationship description
iri false + Relationship IRI. A value is auto assigned by Grafo Server if not specified in create request
positionX false X coordinate in UI
positionY false Y coordinate in UI
cardinalityType false null Exact, Max, Min values can be provided
cardinality false null cardinality value
specialisation false false A flag to identify if a relationship is specialisation or not.
color false #000000 Hex code of the RGB values. List of colors that can be used is provided below.

Color List

Name Hex Code
AMBER_YELLOW #fdc344
LEMON_YELLOW #e2fd24
GREEN #5ff263
CYAN #6FF2CD
PASTEL_BLUE #AACCFF
SKY_BLUE #50A4FD
STEEL_BLUE #717CFD
VIOLET #C88DEF
CORAL_RED #ED5C5C
ORANGE #ea874d
BROWN #ccb487
LIGHT_GREY #d4d4d4
BLACK #000000

Returns

This returns a JSON object for the created relationship. The returned relationship contains id and iri assigned.

Update Relationship

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    Relationship relationshipForUpdate = gClient.getRelationship(docId, 
                 "link-245ae2a0-d7de-466b-b552-8da441ecb2e9");
    relationshipForUpdate.setLabel("UpdatedRel");
    relationship.setIri("www.abc.com/schema/rel1");

    Relationship updatedRelationship = gClient.updateRelationship(docId, relationshipForUpdate);
    System.out.println(updatedRelationship);
}
curl -X POST 
    -d '{"label": "UpdatedRel", "iri": "www.abc.com/schema/rel1"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-245ae2a0-d7de-466b-b552-8da441ecb2e9
var demoUpdateRelationship = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order:
      Label, Specialization, Description, Color, Fields, reserved placeholder which is null, CardinalityType, Cardinality, PositionX, PositionY, Iri, Id
      **********************/
      var updatedRel = await ekgDoc.updateRelationship("UpdatedRel", null, null, null, null, null, null, null, null, null, "www.abc.com/schema/rel1", "link-245ae2a0-d7de-466b-b552-8da441ecb2e9");
      console.log(updatedRel);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "link-245ae2a0-d7de-466b-b552-8da441ecb2e9",
    "type": "link",
    "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
    "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
    "label": "UpdatedRel",
    "description": "Demo Add Relationship",
    "iri": "www.abc.com/schema/rel1",
    "cardinalityType": null,
    "cardinality": null,
    "positionX": null,
    "positionY": null
}

This endpoint updates relationship with the specified id.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>relationships/<id>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
id The ID of the relationship to update

JSON Body

Name Description
label Relationship Label
description Relationship description
iri Relationship IRI
positionX X coordinate in UI
positionY Y coordinate in UI
cardinalityType Exact, Max, Min values can be provided
cardinality cardinality value
color Hex code of the RGB values. List of colors that can be used is provided below.

Color List

Name Hex Code
AMBER_YELLOW #fdc344
LEMON_YELLOW #e2fd24
GREEN #5ff263
CYAN #6FF2CD
PASTEL_BLUE #AACCFF
SKY_BLUE #50A4FD
STEEL_BLUE #717CFD
VIOLET #C88DEF
CORAL_RED #ED5C5C
ORANGE #ea874d
BROWN #ccb487
LIGHT_GREY #d4d4d4
BLACK #000000

Returns

This returns a JSON object for the updated relationship.

Delete Relationship

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String relationshipId = "link-245ae2a0-d7de-466b-b552-8da441ecb2e9";
  GenericGrafoResponse response = gClient.deleteRelationship(docId, relationshipId));
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-245ae2a0-d7de-466b-b552-8da441ecb2e9
var demoDeleteRelationship = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: RelationshipId
      **********************/
     await ekgDoc.deleteRelationship("link-245ae2a0-d7de-466b-b552-8da441ecb2e9");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes relationship for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/relationships/<id>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
id The ID of the relationship to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Relationship Attributes

The term attribute refers to a feature that is part of a concept or relationship. It is a property that has a name, data type and cardinality.

Relationship attribute is identified with an id beginning with linkattr-

All relationship attribute endpoints are fine grained network operations. You can achieve all of these operations at one go using the coarse grained operations on the EkgDocument.

List Relationship Attributes

This endpoint retrieves all the attributes for a relationship within an ekg document. Natural order of attributes is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a"); 
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
    List<Attribute> attribList = gClient.getAllRelationshipAttributes(
        docId, relationshipId);
    attribList.forEach( attrib -> System.out.println(attrib));
}
# Get all attributes for doc and relationship
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/attributes
var demoListAllRelationshipAttributes = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
     var attributeList = await ekgDoc.getRelationshipAttributes("link-2e2069ba-3523-4731-8c41-35189796f7dd");
    console.log(attributeList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "linkattr-b315d309-8583-45a6-b68d-86c929df54db",
        "type": "attribute",
        "label": "relattribute1",
        "description": "",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg/relattribute2_linkattr-b315d309-8583-45a6-b68d-86c929df54db",
        "xsdDataType": {"id": 0, "title": "boolean" },
        "cardinalityType": {"id": 0, "title": "min"},
        "cardinality": "1",
        "fields": [
            {
            "id": "ca397b5b-7303-40ae-817f-b0834c7e2432",
            "title": "Field1",
            "text": "Value1"
            }
        ]
    },
    ......
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relId>/attributes

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the relationship belongs
relId The ID of relationship of which the attributes are retrieved

Returns

This returns an array of all attributes for the specified doc id and relationship id. Each entry in the array is a separate attribute object. Attribute Properties are defined in the section titled EKG Document Coarse Grained Operations

Get Relationship Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd"; 
  String attrId = "linkattr-b315d309-8583-45a6-b68d-86c929df54db";
  Attribute attr = gClient.getRelationshipAttribute(docId, relationshipId, attrId);
  System.out.println(attr);
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/attributes/linkattr-b315d309-8583-45a6-b68d-86c929df54db"
var demoGetRelationshipAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in order: RelationshipId, AttributeId
      **********************/
      var fetchedAttrib = ekgDoc.getRelationshipAttribute("link-2e2069ba-3523-4731-8c41-35189796f7dd", "linkattr-b315d309-8583-45a6-b68d-86c929df54db");
      console.log(fetchedAttrib.toObject());
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "linkattr-b315d309-8583-45a6-b68d-86c929df54db",
    "type": "attribute",
    "label": "relattribute1",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg/relattribute2_linkattr-b315d309-8583-45a6-b68d-86c929df54db",
    "xsdDataType": {"id": 0, "title": "boolean" },
    "cardinalityType": {"id": 0, "title": "min"},
    "cardinality": "1",
    "fields": [
        {
        "id": "ca397b5b-7303-40ae-817f-b0834c7e2432",
        "title": "Field1",
        "text": "Value1"
        }
    ]
}

This endpoint retrieves a specific relationship attribute by id within a ekg document with specified docid and for a specific relationshipid.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
relId ID of the relationship
attribId The ID of the attribute to retrieve

Returns

This returns a JSON object for the attribute.

Create Relationship Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
    Attribute attrib = new Attribute();
    attrib.setLabel("MyAttrib_01");
    attrib.setDescription("Sample description");
    attrib.setXsdDataType(XsdDataType.DATETIME);
    attrib.setCardinalityType(CardinalityType.MIN);
    attrib.setCardinlaity("3");

    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd"
    Attribute attrCreated = gClient.addRelationshipAttribute(docId, relationshipId, attrib);
}
curl -X POST 
    -d '{"label": "MyAttrib_01", "description": "Sample Description", "cardinalityType": "min", "cardinality":"3", "xsdDataType":"datetime"}'
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/attributes
var demoCreateRelationshipAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Label, Description, Fields, XsdDataType, CardinalityType, Cardinality, Iri, Id, RelationshipId
      **********************/
      await ekgDoc.addRelationshipAttribute("MyAttrib_01", "Sample Description", null, null, "min", "3", null, null, "link-2e2069ba-3523-4731-8c41-35189796f7dd");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1",
    "type": "attribute"
    "label": "MyAttrib_01",
    "description": "Sample Description",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-9aaf949e-d4d4-4749-b561-9a762757a1d1_MyAttrib_01",
    "xsdDataType": {"id": 0, "title": "datetime" },
    "cardinalityType": {"id": 0, "title": "min"},
    "cardinality": "3"
}

This endpoint creates an attribute within the specified ekg document and relationship.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/relationships/<relId>/attributes

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
relId The relationship id for which the attribute is created

JSON Body

Name Mandatory Default Description
label true -- Relationship Attribute Label
description false "" Relationship Attribute description
iri false Relationship Attribute IRI. A value is auto assigned by Grafo Server if not specified in create request
fields false empty array of Field objects
xsdDataType false null May be null, boolean, string, float, double, decimal, long, short, integer, int, dateTime, anyURI
cardinalityType false null May be exact, min, max
cardinality false null cardinality value

Returns

This returns a JSON object for the created relationship attribute. The returned relationship attribute contains id and iri assigned.

Update Relationship Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  Relationship relationship = gClient.getRelationship(docId, 
                         "link-2e2069ba-3523-4731-8c41-35189796f7dd");
  List<Attribute> attribList = relationship.getAttributes();
  Attribute attrib = attribList.get(1); //assuming there are atleast 2
  attrib.setLabel("UpdateAttribLbl");
  attrib.setXsdDataType(XsdDataType.DECIMAL);
  attrib.setCardinalityType(CardinalityType.MIN);
  attrib.setCardinality("20");
  Attribute updatedAttr = 
        gClient.updateRelationshipAttribute(docId, relationshipId, attrib);
}
curl -X POST 
    -d '{"label": "UpdateAttribLbl", "cardinality": "20", "cardinalityType": "min", "xsdDataType":"decimal" }' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/attributes/attr-9aaf949e-d4d4-4749-b561-9a762757a1d1
var demoUpdateRelationshipAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Label, Description, Fields, XsdDataType, CardinalityType, Cardinality, Iri, Id, RelationshipId
      **********************/
      await ekgDoc.updateRelationshipAttribute("UpdateAttribLbl", "", null, "decimal", "min", "20", null, "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1", "link-2e2069ba-3523-4731-8c41-35189796f7dd");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1",
    "type": "attribute"
    "label": "UpdateAttribLbl",
    "description": "Sample Description",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg#attr-9aaf949e-d4d4-4749-b561-9a762757a1d1_MyAttrib_01",
    "xsdDataType": {"id": 0, "title": "decimal" },
    "cardinalityType": {"id": 0, "title": "min"},
    "cardinality": "20"
}

This endpoint updates attribute with the specified attribute id within the specified relationship and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/relationships/<relId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The Id of the ekg doc of which the relationship and attributes are retrieved
relId The Id of the relationship
attribId Id of attribute to update

JSON Body

Name Description
label Relationship Attribute Label
description Relationship description
iri Relationship Attribute IRI. A value is auto assigned by Grafo Server if not specified in create request
fields array of Field objects
xsdDataType May be null, boolean, string, float, double, decimal, long, short, integer, int, dateTime, anyURI
cardinalityType May be null, exact, min, max
cardinality cardinality value

Returns

This returns a JSON object for the updated attribute.

Delete Relationship Attribute

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
  String attribId = "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1";
  GenericGrafoResponse response = gClient.deleteRelationshipAttribute(docId, relationshipId, attribId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/attributes/attr-9aaf949e-d4d4-4749-b561-9a762757a1d1
var demoDeleteRelationshipAtttribute = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: RealtionshipId, AttributeId
      **********************/
      await ekgDoc.deleteRelationshipAttribute("link-2e2069ba-3523-4731-8c41-35189796f7dd", "attr-9aaf949e-d4d4-4749-b561-9a762757a1d1");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the relationship attribute for the specified id present within the selected relationship in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/relationships/<relId>/attributes/<attribId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
relId The ID of the relationship of which attribute to delete
attribId The ID of the attribute to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Specializations

Specialization is a type of relationship that mainly depicts parent-child relationship between two concepts. Each specialization is identified by an id beginning with link-

All specialization endpoints are fine grained network operations. You can achieve all of these operations at one go using the coarse grained operations on the EkgDocument.

List Specializations

This endpoint retrieves all the specializations within an EKG document. As the specializations are part of a graph, only the natural order of specializations is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try (GrafoClient gClient = new GrafoClient();) {
    List<Relationship> relList = gClient.getAllSpecializations(UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a"));
    relList.forEach( rel -> System.out.println(rel));
}
# Get all specializations for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/specializations
var demoListAllSpecializations = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
    var specializationList = await ekgDoc.getSpecializations();
    console.log(specializationList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "link-924c5fe3-1e01-4d0a-bcb0-36148887c845",
        "type": "link",
        "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
        "toConceptId": "node-bf7092ca-ca03-4635-ae92-d154d3f11879",
        "label": "",
        "description": "",
        "iri": "http://www.app.gra.fo/schema/untitled-ekg/label_link-924c5fe3-1e01-4d0a-bcb0-36148887c845",
        "specialization": true
    },
    ......
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/specializations

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the specializations are retrieved

Returns

This returns an array of all specializations for the specified doc id. Each entry in the array is a separate specialization object.

Get Specialization

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    Relationship rel = gClient.getSpecialization(docId, "link-924c5fe3-1e01-4d0a-bcb0-36148887c845");
    System.out.println(rel)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/specializations/link-924c5fe3-1e01-4d0a-bcb0-36148887c845"
var demoGetSpecialization = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: RelationshipId
      **********************/
    var fetchedSpcl = ekgDoc.getSpecialization("link-924c5fe3-1e01-4d0a-bcb0-36148887c845");
    console.log(fetchedSpcl.toObject());
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "link-924c5fe3-1e01-4d0a-bcb0-36148887c845",
    "type": "link",
    "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
    "toConceptId": "node-bf7092ca-ca03-4635-ae92-d154d3f11879",
    "label": "",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg/label_link-924c5fe3-1e01-4d0a-bcb0-36148887c845",
    "specialization": true
}

This endpoint retrieves a specific specialization by id within an ekg document with specified docId.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/specializations/<id>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the specializations are retrieved
id The ID of the specialization to retrieve

Returns

This returns a JSON object for the specialization.

Create Specialization

try (GrafoClient gClient = new GrafoClient();) {
    //concept1 and concept2 are start and end nodes of a specialization
    Relationship specialization = new Relationship(concept1, concept2, "", RelationshipType.SPECIALIZATION);
    Relationship newspecialization = gClient.createSpecialization(docId, specialization);
    System.out.println(specialization);
}
curl -X POST 
    -d '{"fromConceptId":"node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
"toConceptId":"node-74232afd-fd3b-4006-99d0-5487c23d83d5", "specialization" : "true"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/specializations
var demoCreateRelationship = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Create or Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order:
      Label(null), FromConceptId, ToConceptId, Specialization(true), Description, Color, Fields, CardinalityType, Cardinality, PositionX, PositionY, Iri
      **********************/
      var relCreated = await ekgDoc.addRelationship("", "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91", "node-74232afd-fd3b-4006-99d0-5487c23d83d5", true);
      console.log(relCreated);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "link-190ae2a0-d7de-466b-b552-8da441ecb2e9",
    "type": "link",
    "fromConceptId": "node-19d8dee3-e5ae-4337-86af-cc4bb415ea91",
    "toConceptId": "node-74232afd-fd3b-4006-99d0-5487c23d83d5",
    "label": "",
    "description": "",
    "iri": "http://www.app.gra.fo/schema/untitled-ekg/link-190ae2a0-d7de-466b-b552-8da441ecb2e9_label",
    "positionX": null,
    "positionY": null,
    "specialization":true
}

This endpoint creates a specialization within the specified ekg document.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/specializations

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the specializations are retrieved

JSON Body

Name Mandatory Default Description
fromConceptId true Id of the start node
toConceptId true Id of the end node
iri false Specialization IRI. A value is auto assigned by Grafo Server if not specified in create request
positionX false X coordinate in UI
positionY false Y coordinate in UI
specialization true false For specialization, this value should be true

Returns

This returns a JSON object for the created specialization. The returned specialization contains id and iri assigned.

Delete Specialization

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String splznId = "link-245ae2a0-d7de-466b-b552-8da441ecb2e9";
  GenericGrafoResponse response = gClient.deleteRelationship(docId, splznId));
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/specializations/link-245ae2a0-d7de-466b-b552-8da441ecb2e9
var demoDeleteSpecialization = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters: SpecializationId
      **********************/
     await ekgDoc.deleteRelationship("link-245ae2a0-d7de-466b-b552-8da441ecb2e9");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes specialization for the specified id.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/specializations/<id>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the specializations are retrieved
id The ID of the specialization to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Concept Fields

Field is a name-value property for Concept.

Each field has a unique ID.

List Concept Fields

This endpoint retrieves all the fields for a concept within an EKG document. As the fields are part of a graph, only the natural order of fields is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    List<Field> fieldList = gClient.getConceptFields(docId, conceptId)
    fieldList.forEach( field -> System.out.println(field));
}
# Get all fields for concept with id node-9d7bf45e-ed14-48b9-9820-65c24608839e for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/fields
var demoListAllConceptFields = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: ConceptId
      **********************/
      var fieldList = ekgDoc.getConceptFields("node-9d7bf45e-ed14-48b9-9820-65c24608839e");
      console.log(fieldList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
        "title": "Test1",
        "text": "Value1"
    },
    {
        "id": "29a44a6b-e870-486b-b1af-8dd4ab81bd1e",
        "title": "Test2",
        "text": "Value2"
    },
    .....
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept is retrieved
conceptId The ID of the concept of which the fields are retrieved

Returns

This returns an array of all fields in the concept for specified id within an EKG document. Each entry in the array is a separate field object.

Field Properties Description
id Field Identifier (UUID)
title Field Title
text Field Value

Get Concept Field

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";
    Field fieldFetched = gClient.getConceptField(docId, conceptId, fieldId);
    System.out.println(fieldFetched)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff"
var demoGetConceptField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: ConceptId, FieldId
      **********************/
      var fetchedField = ekgDoc.getConceptFieldById("node-9d7bf45e-ed14-48b9-9820-65c24608839e", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff");
      console.log(fetchedField);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "Value1"
}

This endpoint retrieves a specific concept field by id within an EKG document with specified docId and for a specific conceptId.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept fields are retrieved
conceptId ID of the concept
fieldId The ID of the field to retrieve

Returns

This returns a JSON object for the field.

Create Concept Field

try (GrafoClient gClient = new GrafoClient();) 
{
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    Field field = new Field("field1");
    field.setText("text1");
    Concept concept = gClient.addConceptField(docId, conceptId, field);
    System.out.println(concept);
}
curl -X POST 
    -d '{"title": "field1", "text": "text1"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/fields
var demoCreateConceptField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, ConceptId
      **********************/
      await ekgDoc.addConceptField("field1", "text1", conceptId);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "19c0101d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "field1",
    "text": "text1"
}

This endpoint creates a field within the specified ekg document and concept.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId The concept id for which the field is created

JSON Body

Name Mandatory Default Description
title true -- Concept Field Title
text false -- Concept Field Value

Returns

This returns a JSON object for the created concept field. The returned concept field contains id assigned.

Update Concept Field

try (GrafoClient gClient = new GrafoClient();)
{
     UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";

    Field fieldToUpdate = gClient.getConceptField(docId, conceptId, fieldId);
    fieldToUpdate.setTitle("updatedField2");

    Concept updatedConcept = gClient.updateConceptField(docId, conceptId, fieldToUpdate);
    System.out.println(updatedConcept);
}
curl -X POST 
    -d '{"id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "text": "updatedField2"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff
var demoUpdateConceptField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, Id, ConceptId
      **********************/
      await ekgDoc.updateConceptField(null, "updatedField2", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "updatedField2"
}

This endpoint updates field with the specified field id within the specified concept and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept and fields are retrieved
conceptId The ID of the concept
fieldId Id of field to update

JSON Body

Name Mandatory Default Description
title false -- Concept Field Title
text false -- Concept Field Value

Returns

This returns a JSON object for the updated field.

Delete Concept Field

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "node-8a21c773-380f-4db9-92a6-f4984efd37ad";
  String fieldId = "29a44a6b-e870-486b-b1af-8dd4ab81bd1e";
  GenerGenericGrafoResponse response = gClient.deleteConceptField(docId, conceptId, fieldId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/fields/29a44a6b-e870-486b-b1af-8dd4ab81bd1e
var demoDeleteConceptField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: ConceptId, FieldId
      **********************/
      await ekgDoc.deleteConceptField("node-8a21c773-380f-4db9-92a6-f4984efd37ad", "29a44a6b-e870-486b-b1af-8dd4ab81bd1e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the concept field for the specified id present within the selected concept in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId The ID of the concept of which field to delete
fieldId The ID of the field to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Concept Attribute Fields

Field is a name-value property for Concept Attribute.

Each field has a unique ID.

List Concept Attribute Fields

This endpoint retrieves all the fields for a concept attribute within an EKG document. As the fields are part of a graph, only the natural order of fields is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    List<Field> fieldList = gClient.getConceptAttributeFields(docId, conceptId, attrId)
    fieldList.forEach( field -> System.out.println(field));
}
# Get all fields for concept with id node-9d7bf45e-ed14-48b9-9820-65c24608839e for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/attr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields
var demoListAllConceptAttributeFields = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: ConceptId, AttributeId
      **********************/
      var fieldList = ekgDoc.getConceptAttributeFields("node-9d7bf45e-ed14-48b9-9820-65c24608839e", "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4");
      console.log(fieldList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
        "title": "Test1",
        "text": "Value1"
    },
    {
        "id": "29a44a6b-e870-486b-b1af-8dd4ab81bd1e",
        "title": "Test2",
        "text": "Value2"
    },
    .....
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attrId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept is retrieved
conceptId The ID of the concept of which the attributes are retrieved
attrId The ID of the attribute

Returns

This returns an array of all fields in the concept attribute for specified id within an EKG document. Each entry in the array is a separate field object.

Field Properties Description
id Field Identifier (UUID)
title Field Title
text Field Value

Get Concept Attribute Field

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";
    Field fieldFetched = gClient.getConceptAttributeField(docId, conceptId, attrId, fieldId);
    System.out.println(fieldFetched)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/attr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff"
var demoGetConceptAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: ConceptId, AttrId, FieldId
      **********************/
      var fetchedField = ekgDoc.getConceptAttributeField("node-9d7bf45e-ed14-48b9-9820-65c24608839e", "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4","40b8601d-6f41-4a2f-ad0a-bce7a714a6ff");
      console.log(fetchedField);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "Value1"
}

This endpoint retrieves a specific concept attribute field by id within an EKG document with specified docId, conceptId and attribute Id.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept is retrieved
conceptId ID of the concept
attrId ID of the attribute
fieldId The ID of the field to retrieve

Returns

This returns a JSON object for the field.

Create Concept Attribute Field

try (GrafoClient gClient = new GrafoClient();) 
{
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    Field field = new Field("field1");
    field.setText("text1");
    gClient.addConceptAttributeField(docId, conceptId, attrId, field);
}
curl -X POST 
    -d '{"title": "field1", "text": "text1"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/attr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields
var demoCreateConceptAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, AttrId, ConceptId
      **********************/
      await ekgDoc.addConceptAttributeField("field1", "text1", "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4", "node-9d7bf45e-ed14-48b9-9820-65c24608839e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "19c0101d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "field1",
    "text": "text1"
}

This endpoint creates a field within the specified ekg document and concept.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attrId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts is retrieved
conceptId The concept id of which the attribute is retrieved
attrId The attribute id for which the field is created

JSON Body

Name Mandatory Default Description
title true -- Concept Attribute Field Title
text false -- Concept Attribute Field Value

Returns

This returns a JSON object for the created concept attribute field. The returned concept attribute field contains id assigned.

Update Concept Attribute Field

try (GrafoClient gClient = new GrafoClient();)
{
     UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String conceptId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";

    Field fieldToUpdate = gClient.getConceptAttributeField(docId, conceptId, attrId, fieldId);
    fieldToUpdate.setTitle("updatedField2");

    Concept updatedConcept = gClient.updateConceptAttributeField(docId, conceptId, attrId, fieldToUpdate);
    System.out.println(updatedConcept);
}
curl -X POST 
    -d '{"id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "text": "updatedField2"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/attr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff
var demoUpdateConceptField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, Id, AttrId, ConceptId
      **********************/
      await ekgDoc.updateConceptAttributeField(null, "updatedField2", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4","node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "updatedField2"
}

This endpoint updates field with the specified field id within the specified concept and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concept is retrieved
conceptId The ID of the concept of which the attribute is retrieved
attrId The ID of the attribute of which the field is retrieved
fieldId Id of field to update

JSON Body

Name Mandatory Default Description
title false -- Concept Attribute Field Title
text false -- Concept Attribute Field Value

Returns

This returns a JSON object for the updated field.

Delete Concept Attribute Field

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String conceptId = "node-8a21c773-380f-4db9-92a6-f4984efd37ad";
  String attrId = "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
  String fieldId = "29a44a6b-e870-486b-b1af-8dd4ab81bd1e";
  GenerGenericGrafoResponse response = gClient.deleteConceptAttributeField(docId, conceptId, attrId, fieldId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/attr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/29a44a6b-e870-486b-b1af-8dd4ab81bd1e
var demoDeleteConceptAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: ConceptId, AttrId, FieldId
      **********************/
      await ekgDoc.deleteConceptAttributeField("node-8a21c773-380f-4db9-92a6-f4984efd37ad", "attr-fc2193b4-01fe-4cfa-875e-3208027a3da4","29a44a6b-e870-486b-b1af-8dd4ab81bd1e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the concept attribute field for the specified id present within the selected concept in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the concepts are retrieved
conceptId The ID of the concept of which attribute is retrieved
attrId The ID of the attribute of which field is to be deleted
fieldId The ID of the field to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Relationship Fields

Field is a name-value property for Relationship.

Each field has a unique ID.

List Relationship Fields

This endpoint retrieves all the fields for a relationship within an EKG document. As the fields are part of a graph, only the natural order of fields is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
    List<Field> fieldList = gClient.getRelationshipFields(docId, relationshipId)
    fieldList.forEach( field -> System.out.println(field));
}
# Get all fields for relationship with id link-2e2069ba-3523-4731-8c41-35189796f7dd for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/fields
var demoListAllRelationshipFields = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: RelationshipId
      **********************/
      var fieldList = ekgDoc.getRelationshipFields("link-2e2069ba-3523-4731-8c41-35189796f7dd");
      console.log(fieldList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
        "title": "Test1",
        "text": "Value1"
    },
    {
        "id": "29a44a6b-e870-486b-b1af-8dd4ab81bd1e",
        "title": "Test2",
        "text": "Value2"
    },
    .....
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship is retrieved
relationshipId The ID of the relationship of which the fields are retrieved

Returns

This returns an array of all fields in the relationship for specified id within an EKG document. Each entry in the array is a separate field object.

Field Properties Description
id Field Identifier (UUID)
title Field Title
text Field Value

Get Relationship Field

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";
    Field fieldFetched = gClient.getRelationshipField(docId, relationshipId, fieldId);
    System.out.println(fieldFetched)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-9d7bf45e-ed14-48b9-9820-65c24608839e/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff"
var demoGetRelationshipField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: RelationshipId, FieldId
      **********************/
      var fetchedField = ekgDoc.getRelationshipFieldById("link-2e2069ba-3523-4731-8c41-35189796f7dd", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff");
      console.log(fetchedField);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "Value1"
}

This endpoint retrieves a specific relationship field by id within an EKG document with specified docId and for a specific relationshipId.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship fields are retrieved
relationshipId ID of the relationship
fieldId The ID of the field to retrieve

Returns

This returns a JSON object for the field.

Create Relationship Field

try (GrafoClient gClient = new GrafoClient();) 
{
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
    Field field = new Field("field1");
    field.setText("text1");
    Relationship relationship = gClient.addRelationshipField(docId, relationshipId, field);
    System.out.println(relationship);
}
curl -X POST 
    -d '{"title": "field1", "text": "text1"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/fields
var demoCreateRelationshipField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, RelationshipId
      **********************/
      await ekgDoc.addRelationshipField("field1", "text1", relationshipId);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "19c0101d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "field1",
    "text": "text1"
}

This endpoint creates a field within the specified ekg document and relationship.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
relationshipId The relationship id for which the field is created

JSON Body

Name Mandatory Default Description
title true -- Relationship Field Title
text false -- Relationship Field Value

Returns

This returns a JSON object for the created relationship field. The returned relationship field contains id assigned.

Update Relationship Field

try (GrafoClient gClient = new GrafoClient();)
{
     UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";

    Field fieldToUpdate = gClient.getRelationshipField(docId, relationshipId, fieldId);
    fieldToUpdate.setTitle("updatedField2");

    Relationship updatedRelationship = gClient.updateRelationshipField(docId, relationshipId, fieldToUpdate);
    System.out.println(updatedRelationship);
}
curl -X POST 
    -d '{"id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "text": "updatedField2"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff
var demoUpdateRelationshipField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, Id, RelationshipId
      **********************/
      await ekgDoc.updateRelationshipField(null, "updatedField2", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "link-2e2069ba-3523-4731-8c41-35189796f7dd");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "updatedField2"
}

This endpoint updates field with the specified field id within the specified relationship and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship and fields are retrieved
relationshipId The ID of the relationship
fieldId Id of field to update

JSON Body

Name Mandatory Default Description
title false -- Relationship Field Title
text false -- Relationship Field Value

Returns

This returns a JSON object for the updated field.

Delete Relationship Field

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String relationshipId = "link-2e2069ba-3523-4731-8c41-35189796f7dd";
  String fieldId = "29a44a6b-e870-486b-b1af-8dd4ab81bd1e";
  GenerGenericGrafoResponse response = gClient.deleteRelationshipField(docId, relationshipId, fieldId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-2e2069ba-3523-4731-8c41-35189796f7dd/fields/29a44a6b-e870-486b-b1af-8dd4ab81bd1e
var demoDeleteRelationshipField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: RelationshipId, FieldId
      **********************/
      await ekgDoc.deleteRelationshipField("link-2e2069ba-3523-4731-8c41-35189796f7dd", "29a44a6b-e870-486b-b1af-8dd4ab81bd1e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the relationship field for the specified id present within the selected relationship in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships are retrieved
relationshipId The ID of the relationship of which field to delete
fieldId The ID of the field to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Relationship Attribute Fields

Field is a name-value property for Relationship Attribute.

Each field has a unique ID.

List Relationship Attribute Fields

This endpoint retrieves all the fields for a relationship attribute within an EKG document. As the fields are part of a graph, only the natural order of fields is followed. This generally happens to be the order of addition. No other sort criteria can be applied. No filtering or pagination is supported.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    List<Field> fieldList = gClient.getRelationshipAttributeFields(docId, relationshipId, attrId)
    fieldList.forEach( field -> System.out.println(field));
}
# Get all fields for relationship with id node-9d7bf45e-ed14-48b9-9820-65c24608839e for the doc with id 536a35f8-cb7b-41c6-a834-c4c03516657a
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields
var demoListAllRelationshipAttributeFields = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: RelationshipId, AttributeId
      **********************/
      var fieldList = ekgDoc.getRelationshipAttributeFields("node-9d7bf45e-ed14-48b9-9820-65c24608839e", "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4");
      console.log(fieldList);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

[
    {
        "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
        "title": "Test1",
        "text": "Value1"
    },
    {
        "id": "29a44a6b-e870-486b-b1af-8dd4ab81bd1e",
        "title": "Test2",
        "text": "Value2"
    },
    .....
]

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attrId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship is retrieved
relationshipId The ID of the relationship of which the attributes are retrieved
attrId The ID of the attribute

Returns

This returns an array of all fields in the relationship attribute for specified id within an EKG document. Each entry in the array is a separate field object.

Field Properties Description
id Field Identifier (UUID)
title Field Title
text Field Value

Get Relationship Attribute Field

try ( GrafoClient gClient = new GrafoClient(); ) {
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";
    Field fieldFetched = gClient.getRelationshipAttributeField(docId, relationshipId, attrId, fieldId);
    System.out.println(fieldFetched)
}
curl "https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff"
var demoGetRelationshipAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
       /*********************
      Parameters: RelationshipId, AttrId, FieldId
      **********************/
      var fetchedField = ekgDoc.getRelationshipAttributeField("node-9d7bf45e-ed14-48b9-9820-65c24608839e", "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4","40b8601d-6f41-4a2f-ad0a-bce7a714a6ff");
      console.log(fetchedField);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "Value1"
}

This endpoint retrieves a specific relationship attribute field by id within an EKG document with specified docId, relationshipId and attribute Id.

HTTP Request

GET https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship is retrieved
relationshipId ID of the relationship
attrId ID of the attribute
fieldId The ID of the field to retrieve

Returns

This returns a JSON object for the field.

Create Relationship Attribute Field

try (GrafoClient gClient = new GrafoClient();) 
{
    UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    Field field = new Field("field1");
    field.setText("text1");
    gClient.addRelationshipAttributeField(docId, relationshipId, attrId, field);
}
curl -X POST 
    -d '{"title": "field1", "text": "text1"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-9d7bf45e-ed14-48b9-9820-65c24608839e/attributes/linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields
var demoCreateRelationshipAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, AttrId, RelationshipId
      **********************/
      await ekgDoc.addRelationshipAttributeField("field1", "text1", "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4", "node-9d7bf45e-ed14-48b9-9820-65c24608839e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "19c0101d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "field1",
    "text": "text1"
}

This endpoint creates a field within the specified ekg document and relationship.

HTTP Request

POST https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attrId>/fields

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationships is retrieved
relationshipId The relationship id of which the attribute is retrieved
attrId The attribute id for which the field is created

JSON Body

Name Mandatory Default Description
title true -- Relationship Attribute Field Title
text false -- Relationship Attribute Field Value

Returns

This returns a JSON object for the created relationship attribute field. The returned relationship attribute field contains id assigned.

Update Relationship Attribute Field

try (GrafoClient gClient = new GrafoClient();)
{
     UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
    String relationshipId = "node-9d7bf45e-ed14-48b9-9820-65c24608839e";
    String attrId = "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
    String fieldId = "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff";

    Field fieldToUpdate = gClient.getRelationshipAttributeField(docId, relationshipId, attrId, fieldId);
    fieldToUpdate.setTitle("updatedField2");

    Relationship updatedRelationship = gClient.updateRelationshipAttributeField(docId, relationshipId, attrId, fieldToUpdate);
    System.out.println(updatedRelationship);
}
curl -X POST 
    -d '{"id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "text": "updatedField2"}' 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/40b8601d-6f41-4a2f-ad0a-bce7a714a6ff
var demoUpdateRelationshipField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: Title, Text, Id, AttrId, RelationshipId
      **********************/
      await ekgDoc.updateRelationshipAttributeField(null, "updatedField2", "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff", "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4","node-8a21c773-380f-4db9-92a6-f4984efd37ad");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
    "id": "40b8601d-6f41-4a2f-ad0a-bce7a714a6ff",
    "title": "Test1",
    "text": "updatedField2"
}

This endpoint updates field with the specified field id within the specified relationship and ekg doc.

HTTP Request

PUT https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship is retrieved
relationshipId The ID of the relationship of which the attribute is retrieved
attrId The ID of the attribute of which the field is retrieved
fieldId Id of field to update

JSON Body

Name Mandatory Default Description
title false -- Relationship Attribute Field Title
text false -- Relationship Attribute Field Value

Returns

This returns a JSON object for the updated field.

Delete Relationship Attribute Field

try ( GrafoClient gClient = new GrafoClient(); ) {
  UUID docId = UUID.fromString("536a35f8-cb7b-41c6-a834-c4c03516657a");
  String relationshipId = "node-8a21c773-380f-4db9-92a6-f4984efd37ad";
  String attrId = "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4";
  String fieldId = "29a44a6b-e870-486b-b1af-8dd4ab81bd1e";
  GenerGenericGrafoResponse response = gClient.deleteRelationshipAttributeField(docId, relationshipId, attrId, fieldId);
}
curl -X DELETE 
    https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4/fields/29a44a6b-e870-486b-b1af-8dd4ab81bd1e
var demoDeleteRelationshipAttributeField = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

      //Fetch EKG Document. Refer Documentation on EKG Document
      /*********************
      Parameters in Order: RelationshipId, AttrId, FieldId
      **********************/
      await ekgDoc.deleteRelationshipAttributeField("node-8a21c773-380f-4db9-92a6-f4984efd37ad", "linkattr-fc2193b4-01fe-4cfa-875e-3208027a3da4","29a44a6b-e870-486b-b1af-8dd4ab81bd1e");
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{
  "success": true
}

This endpoint deletes the relationship attribute field for the specified id present within the selected relationship in the ekg doc.

HTTP Request

DELETE https://app.gra.fo/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attrId>/fields/<fieldId>

URL Parameters

Parameter Description
docId The ID of the ekg doc of which the relationship is retrieved
relationshipId The ID of the relationship of which attribute is retrieved
attrId The ID of the attribute of which field is to be deleted
fieldId The ID of the field to delete

Returns

This returns whether the deletion succeeded. If not, then an error will be returned as per error specification at the top of this document.

Comments and Replies

Grafo UI Editor provides users with option for commenting on a concept, relationship, concept attribute and relationship attribute. Users can also respond to these comments.
Grafo Client REST API can list these comments and replies for a given identifier for concept, relationship, concept attribute and relationship attribute.

Specifics

Query Parameters

Common List Paging params of page and limit are supported. Please see Pagination section for those details. Created Date is the only other query params common to all comment and reply listing.

Parameter Child Arguments Default Mandatory Description
created false Optional filter on the list based on the created field. Exact check. This (and all child argument) values are in yyyy-MM-dd format
gt false Optional lower bound filter for the created field in list. Excludes the entities created on lower bound itself
gte false Optional lower bound filter for the created field in list. Includes the entities created on lower bound.
lt false Optional upper bound filter for the created field in list. Excludes the entities created on upper bound itself
lte false Optional upper bound filter for the created field in list. Includes the entities created on upper bound.

Returns

This returns a JSON object containing array of comments/replies and the page number. The array contains comments/replies limited by the limit requested (or less if this is the last page), for the current page requested. Each entry in the array is a separate comment/reply object.

Concept Comments & Replies

Comments and Replies on a specified Concept in an EKG Document

List Concept Comments

This endpoint retrieves all comments for a given concept within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String conceptId = "..."; 
    CommentSearchCriteria filter = 
    new CommentSearchCriteria().limit(20).createdBefore(LocalDateTime.now())
        .docId(docId).conceptId(conceptId);
  for (Iterator<Comment> comIter = gClient.getConceptComments(filter);
                            comIter.hasNext();) 
  {
    Comment com = comIter.next();
    System.out.println(com.getText());
    if (com.isResolved())
        System.out.println(com.getDateResolved());
    }
  }
}
# No search criteria. Get 1st page comments for doc & concept. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments

#List comments 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?page=2&limit=20

#List Comments created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created=2019-01-23

#List comments created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[lte]=2019-01-23

#List comments created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[lt]=2019-01-23

#List comments created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gt]=2017-03-05

#List comments created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gte]=2017-03-05

# List comments created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gt]=2017-03-05&created[lt]=2019-01-23

# List comments created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetConceptComments = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var commSearchCriteria = new CommentSearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setConceptId("node-8a21c773-380f-4db9-92a6-f4984efd37ad").createdOn("2018-11-27");
    var allComments = await grafoClient.getComments(commSearchCriteria);
    console.log(allComments);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "comments":
    [ 
        { 
            "id": '02ecb9c9-9bc7-4508-b9f8-110a4c5521a1',
            "text": 'Test Comment',
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192084,
            "resolved": 1,
            "dateResolved": 1542192087 
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/concepts/<conceptId>/comments

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the concept belongs
conceptId Id of the concept for which comments are fetched

Returns

This returns an array of all comments for the specified doc and concept id. Each entry in the array is a separate comment object.

Comment Properties Description
id Comment Identifier
text Comment Text
createdBy User id of the person that created this comment
dateCreated Comment creation Date
resolved Whether issue raised by comment resolved or not. 0 or 1
dateResolved If issue is resolved then a valid date of resolution, else null

List Concept Comment Replies

This endpoint retrieves all comment replies for a given comment associated with a concept within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String conceptId = "..."; UUID commentId = ...;
    ReplySearchCriteria filter = 
    new ReplySearchCriteria().limit(20).createdBefore(LocalDateTime.now()).docId(docId).conceptId(conceptId).commentId(commentId);
  for (Iterator<Reply> repIter = gClient.getConceptCommentReplies(filter);
                            repIter.hasNext();) 
  {
    Reply rep = repIter.next();
    System.out.println(rep.getText());
  }
}
# No search criteria. Get 1st page replies for doc, concept & comment. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies

#List replies for selected comment 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?page=2&limit=20

#List replies for selected comment created on 2019 Jan 23 
#(page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created=2019-01-23

#List replies for selected comment created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lte]=2019-01-23

#List replies for selected comment created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lt]=2019-01-23

#List replies for selected comment created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05

#List replies for selected comment created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05&created[lt]=2019-01-23

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetConceptCommentReplies = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var replySearchCriteria = new ReplySearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setConceptId("node-8a21c773-380f-4db9-92a6-f4984efd37ad").setCommentId("02ecb9c9-9bc7-4508-b9f8-110a4c5521a1").createdOn("2019-01-23");
    var allReplies = await grafoClient.getReplies(replySearchCriteria);
    console.log(allReplies);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "replies":
    [ 
        { 
            "id": '8b65e8be-ba90-4b9c-a5f9-12e1fdd13674',
            "text": 'Test Comment Reply',
            "replyFor": "02ecb9c9-9bc7-4508-b9f8-110a4c5521a1"
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192098
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/concepts/<conceptId>/comments/<commentId>/replies

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the concept belongs
conceptId Id of the concept for which comment replies are fetched
commentId Id of the comment for which replies are fetched

Returns

This returns an array of all comment replies for the specified docid, conceptid and comment id. Each entry in the array is a separate comment reply object.

Comment Reply Properties Description
id Comment Reply Identifier
text Comment Reply Text
replyFor Comment for which this reply exists
createdBy User id of the person that created this comment reply
dateCreated Comment Reply creation Date

Relationship Comments & Replies

Comments and Replies on a specified Relationship in an EKG Document

List Relationship Comments

This endpoint retrieves all comments for a given relationship within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String relationshipId = "..."; 
    CommentSearchCriteria filter = 
    new CommentSearchCriteria().limit(20).createdBefore(LocalDateTime.now())
        .docId(docId).relationshipId(relationshipId);
  for (Iterator<Comment> comIter = gClient.getRelationshipComments(filter);
                            comIter.hasNext();) 
  {
    Comment com = comIter.next();
    System.out.println(com.getText());
    if (com.isResolved())
        System.out.println(com.getDateResolved());
    }
  }
}
# No search criteria. Get 1st page comments for doc & relationship. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments

#List comments 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?page=2&limit=20

#List Comments created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created=2019-01-23

#List comments created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[lte]=2019-01-23

#List comments created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[lt]=2019-01-23

#List comments created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gt]=2017-03-05

#List comments created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gte]=2017-03-05

# List comments created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gt]=2017-03-05&created[lt]=2019-01-23

# List comments created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetRelationshipComments = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var commSearchCriteria = new CommentSearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setRelationshipId("link-8a21c773-380f-4db9-92a6-f4984efd37ad").createdOn("2018-11-27");
    var allComments = await grafoClient.getComments(commSearchCriteria);
    console.log(allComments);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "comments":
    [ 
        { 
            "id": '02ecb9c9-9bc7-4508-b9f8-110a4c5521a1',
            "text": 'Test Comment',
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192084,
            "resolved": 1,
            "dateResolved": 1542192087 
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/relationships/<relationshipId>/comments

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the relationship belongs
relationshipId Id of the relationship for which comments are fetched

Returns

This returns an array of all comments for the specified doc and relationship id. Each entry in the array is a separate comment object.

Comment Properties Description
id Comment Identifier
text Comment Text
createdBy User id of the person that created this comment
dateCreated Comment creation Date
resolved Whether issue raised by comment resolved or not. 0 or 1
dateResolved If issue is resolved then a valid date of resolution, else null

List Relationship Comment Replies

This endpoint retrieves all comment replies for a given comment associated with a relationship within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String relationshipId = "..."; UUID commentId = ...;
    ReplySearchCriteria filter = 
    new ReplySearchCriteria().limit(20).createdBefore(LocalDateTime.now()).docId(docId).relationshipId(relationshipId).commentId(commentId);
  for (Iterator<Reply> repIter = gClient.getRelationshipCommentReplies(filter);
                            repIter.hasNext();) 
  {
    Reply rep = repIter.next();
    System.out.println(rep.getText());
  }
}
# No search criteria. Get 1st page replies for doc, relationship & comment. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies

#List replies for selected comment 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?page=2&limit=20

#List replies for selected comment created on 2019 Jan 23 
#(page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created=2019-01-23

#List replies for selected comment created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lte]=2019-01-23

#List replies for selected comment created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lt]=2019-01-23

#List replies for selected comment created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05

#List replies for selected comment created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05&created[lt]=2019-01-23

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetRelationshipCommentReplies = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var replySearchCriteria = new ReplySearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setRelationshipId("link-8a21c773-380f-4db9-92a6-f4984efd37ad").setCommentId("02ecb9c9-9bc7-4508-b9f8-110a4c5521a1").createdOn("2019-01-23");
    var allReplies = await grafoClient.getReplies(replySearchCriteria);
    console.log(allReplies);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "replies":
    [ 
        { 
            "id": '8b65e8be-ba90-4b9c-a5f9-12e1fdd13674',
            "text": 'Test Comment Reply',
            "replyFor": "02ecb9c9-9bc7-4508-b9f8-110a4c5521a1"
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192098
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/relationships/<relationshipId>/comments/<commentId>/replies

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the relationship belongs
relationshipId Id of the relationship for which comment replies are fetched
commentId Id of the comment for which replies are fetched

Returns

This returns an array of all comment replies for the specified docid, relationshipid and comment id. Each entry in the array is a separate comment reply object.

Comment Reply Properties Description
id Comment Reply Identifier
text Comment Reply Text
replyFor Comment for which this reply exists
createdBy User id of the person that created this comment reply
dateCreated Comment Reply creation Date

Concept Attribute Comments & Replies

Comments and Replies on a specified Concept Attribute in an EKG Document

List Concept Attribute Comments

This endpoint retrieves all comments for a given attribute with a specified concept and within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String conceptId = "..."; String attribId = "..";
    CommentSearchCriteria filter = 
    new CommentSearchCriteria().limit(20).createdBefore(LocalDateTime.now())
        .docId(docId).conceptId(conceptId).attributeId(attribId);
  for (Iterator<Comment> comIter = gClient.getConceptAttributeComments(filter);
                            comIter.hasNext();) 
  {
    Comment com = comIter.next();
    System.out.println(com.getText());
    if (com.isResolved())
        System.out.println(com.getDateResolved());
    }
  }
}
# No search criteria. Get 1st page comments for doc, concept, attribute. 
# Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments

#List comments 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?page=2&limit=20

#List Comments created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created=2019-01-23

#List comments created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[lte]=2019-01-23

#List comments created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[lt]=2019-01-23

#List comments created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[gt]=2017-03-05

#List comments created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[gte]=2017-03-05

# List comments created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[gt]=2017-03-05&created[lt]=2019-01-23

# List comments created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetConceptAttributeComments = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var commSearchCriteria = new CommentSearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setConceptId("node-8a21c773-380f-4db9-92a6-f4984efd37ad").setAttributeId("c784a254-77da-4398-914a-20cb9bd5985a").createdOn("2018-11-27");
    var allComments = await grafoClient.getComments(commSearchCriteria);
    console.log(allComments);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "comments":
    [ 
        { 
            "id": '02ecb9c9-9bc7-4508-b9f8-110a4c5521a1',
            "text": 'Test Comment',
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192084,
            "resolved": 1,
            "dateResolved": 1542192087 
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attribId>/comments

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the concept belongs
conceptId Id of the concept for which comments are fetched
attribbId Id of the concept attribute

Returns

This returns an array of all comments for the specified doc id, concept id and attribute id. Each entry in the array is a separate comment object.

Comment Properties Description
id Comment Identifier
text Comment Text
createdBy User id of the person that created this comment
dateCreated Comment creation Date
resolved Whether issue raised by comment resolved or not. 0 or 1
dateResolved If issue is resolved then a valid date of resolution, else null

List Concept Attribute Comment Replies

This endpoint retrieves all comment replies for a given comment associated with a attribute in a concept within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String conceptId = "..."; 
    String attribId = "..."; UUID commentId = ...;
    ReplySearchCriteria filter = 
    new ReplySearchCriteria().limit(20).createdBefore(LocalDateTime.now())
        .docId(docId).conceptId(conceptId).attributeId(attribId)
        .commentId(commentId);
  for (Iterator<Reply> repIter = gClient.getConceptAttributeCommentReplies(filter);
                            repIter.hasNext();) 
  {
    Reply rep = repIter.next();
    System.out.println(rep.getText());
  }
}
# No search criteria. Get 1st page replies for doc, concept & comment. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies

#List replies for selected comment 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?page=2&limit=20

#List replies for selected comment created on 2019 Jan 23 
#(page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created=2019-01-23

#List replies for selected comment created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lte]=2019-01-23

#List replies for selected comment created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lt]=2019-01-23

#List replies for selected comment created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05

#List replies for selected comment created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05&created[lt]=2019-01-23

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/concepts/node-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/c784a254-77da-4398-914a-20cb9bd5985a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetConceptAttributeCommentReplies = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var replySearchCriteria = new ReplySearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setConceptId("node-8a21c773-380f-4db9-92a6-f4984efd37ad").setAttributeId("c784a254-77da-4398-914a-20cb9bd5985a").setCommentId("02ecb9c9-9bc7-4508-b9f8-110a4c5521a1").createdOn("2019-01-23");
    var allReplies = await grafoClient.getReplies(replySearchCriteria);
    console.log(allReplies);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "replies":
    [ 
        { 
            "id": '8b65e8be-ba90-4b9c-a5f9-12e1fdd13674',
            "text": 'Test Comment Reply',
            "replyFor": "02ecb9c9-9bc7-4508-b9f8-110a4c5521a1"
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192098
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/concepts/<conceptId>/attributes/<attributeId>/comments/<commentId>/replies

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the concept belongs
conceptId Id of the concept for which comment replies are fetched
attributeId Id of the concept attribute
commentId Id of the comment for which replies are fetched

Returns

This returns an array of all comment replies for the specified docid, conceptid, attribute id and comment id. Each entry in the array is a separate comment reply object.

Comment Reply Properties Description
id Comment Reply Identifier
text Comment Reply Text
replyFor Comment for which this reply exists
createdBy User id of the person that created this comment reply
dateCreated Comment Reply creation Date

Relationship Attribute Comments & Replies

Comments and Replies on a specified Relationship in an EKG Document

List Relationship Attribute Comments

This endpoint retrieves all comments for a given attribute in a relationship within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String relationshipId = "..."; 
    String attribId = "...";
    CommentSearchCriteria filter = 
    new CommentSearchCriteria().limit(20).createdBefore(LocalDateTime.now())
        .docId(docId).relationshipId(relationshipId).attributeId(attribId);
  for (Iterator<Comment> comIter = 
            gClient.getRelationshipAttributeComments(filter);
            comIter.hasNext();
      ) 
  {
    Comment com = comIter.next();
    System.out.println(com.getText());
    if (com.isResolved())
        System.out.println(com.getDateResolved());
    }
  }
}
# No search criteria. Get 1st page comments for doc, relationship & attribute. 
# Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments

#List comments 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?page=2&limit=20

#List Comments created on 2019 Jan 23 (page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created=2019-01-23

#List comments created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[lte]=2019-01-23

#List comments created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[lt]=2019-01-23

#List comments created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[gt]=2017-03-05

#List comments created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[gte]=2017-03-05

# List comments created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[gt]=2017-03-05&created[lt]=2019-01-23

# List comments created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetRelAttributeComments = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var commSearchCriteria = new CommentSearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setRelationshipId("link-8a21c773-380f-4db9-92a6-f4984efd37ad").setAttributeId("c784a254-77da-4398-914a-20cb9bd5985a").createdOn("2018-11-27");
    var allComments = await grafoClient.getComments(commSearchCriteria);
    console.log(allComments);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "comments":
    [ 
        { 
            "id": '02ecb9c9-9bc7-4508-b9f8-110a4c5521a1',
            "text": 'Test Comment',
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192084,
            "resolved": 1,
            "dateResolved": 1542192087 
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attribId>comments

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the relationship belongs
relationshipId Id of the relationship for which comments are fetched
attribId Id of the relationship attribute

Returns

This returns an array of all comments for the specified doc, relationship and attribute id. Each entry in the array is a separate comment object.

Comment Properties Description
id Comment Identifier
text Comment Text
createdBy User id of the person that created this comment
dateCreated Comment creation Date
resolved Whether issue raised by comment resolved or not. 0 or 1
dateResolved If issue is resolved then a valid date of resolution, else null

List Relationship Attribute Comment Replies

This endpoint retrieves all comment replies for a given comment associated with an attribute of a relationship within a ekg document.

try ( GrafoClient gClient = new GrafoClient(); )  {
    UUID docId = ...; String relationshipId = "..."; 
    String attribId = "..."; UUID commentId = ...;
    ReplySearchCriteria filter = 
    new ReplySearchCriteria().limit(20).createdBefore(LocalDateTime.now()).docId(docId).relationshipId(relationshipId)
        attributeId(attribId).commentId(commentId);
  for (Iterator<Reply> repIter = 
            gClient.getRelationshipAttributeCommentReplies(filter);
            repIter.hasNext();
        ) 
  {
    Reply rep = repIter.next();
    System.out.println(rep.getText());
  }
}
# No search criteria. Get 1st page replies for doc, relationship & comment. Limit 50
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies

#List replies for selected comment 2nd page and limit 20
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?page=2&limit=20

#List replies for selected comment created on 2019 Jan 23 
#(page 1 assumed unless specified)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created=2019-01-23

#List replies for selected comment created on or before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lte]=2019-01-23

#List replies for selected comment created before 2019 Jan 23
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[lt]=2019-01-23

#List replies for selected comment created after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05

#List replies for selected comment created on or after 2017 March 5
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23
# (excluding both days)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gt]=2017-03-05&created[lt]=2019-01-23

# List replies for selected comment created between 2017 March 5 and 2019 Jan 23 
# (both dates inclusive)
curl https://app.gra.fo/api/v1/documents/536a35f8-cb7b-41c6-a834-c4c03516657a/relationships/link-8a21c773-380f-4db9-92a6-f4984efd37ad/attributes/bf406b39-2dff-4374-8fd2-d25ab1601d7a/comments/02ecb9c9-9bc7-4508-b9f8-110a4c5521a1/replies?created[gte]=2017-03-05&created[lte]=2019-01-23
var demoGetRelAttributeCommentReplies = async function() {
  try {
      //After initial authentication..
      //Refer Section on Authentication

    var replySearchCriteria = new ReplySearchCriteria().setDocId("536a35f8-cb7b-41c6-a834-c4c03516657a").setRelationshipId("link-8a21c773-380f-4db9-92a6-f4984efd37ad").setAttributeId("c784a254-77da-4398-914a-20cb9bd5985a").setCommentId("02ecb9c9-9bc7-4508-b9f8-110a4c5521a1").createdOn("2019-01-23");
    var allReplies = await grafoClient.getReplies(replySearchCriteria);
    console.log(allReplies);
  } catch(err) {
    console.log(err);
  } 
};

The above command returns JSON structured like this: (Java and Javascript map JSON to their respective data structures)

{ 
    "page": 1
    "replies":
    [ 
        { 
            "id": '8b65e8be-ba90-4b9c-a5f9-12e1fdd13674',
            "text": 'Test Comment Reply',
            "replyFor": "02ecb9c9-9bc7-4508-b9f8-110a4c5521a1"
            "createdBy": '892dd51b-c394-4d0b-a7cf-e7a0df34d7aa',
            "dateCreated": 1542192098
        },
      ..
    ]
}

HTTP Request

GET http://example.com/api/v1/documents/<docId>/relationships/<relationshipId>/attributes/<attribId>/comments/<commentId>/replies

URL Parameters

Parameter Description
docId The ID of the ekg doc to which the relationship belongs
relationshipId Id of the relationship for which comment replies are fetched
attribId Id of the relationship attribute
commentId Id of the comment for which replies are fetched

Returns

This returns an array of all comment replies for the specified docid, relationship id, attribute id and comment id. Each entry in the array is a separate comment reply object.

Comment Reply Properties Description
id Comment Reply Identifier
text Comment Reply Text
replyFor Comment for which this reply exists
createdBy User id of the person that created this comment reply
dateCreated Comment Reply creation Date