Product Documentation

FairCom REST API Reference

Previous Topic

Next Topic

Index

Methods are provided for creating, deleting, and retrieving information about indexes.:

Previous Topic

Next Topic

Create Index - POST

Create an index for the specified table and database. Each field included in the body will comprise a segment of the index in the order given.

Type: POST

URL: /ctree/api/v1/index/{db}/{table}/{index}

Parameters:

  • db (required) - Database Name
  • table (required) - Table Name
  • index (required) - Index Name

Body:

A JSON string containing an array of objects specifying segments to add to the index, as well as settings for the index. Each object will consist of a field name and settings for the segment.

The fields property is an array of objects consisting of the following:

The name property is a required string identifying a field by name to include in the index.

The ascending property is an optional Boolean (defaults to true) that controls the collation direction of this index segment. Setting it to true causes the segment to put the "smallest" value first ascending to the "largest" value. Setting it to false reverses this segment to go from "largest" descending to "smallest".

Example:

{

"fields": [{

"name": "part_name"

},

{

"name": "part_number",

"ascending": false

}

],

"unique": true

}

JSON field Example:

{

"fields": [{

"name": "json_field",

"key": "my_important_property",

"type": "string",

"size": 100

}]

}

When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.

Response:

  • 200 - OK.
  • 400 - URI is in the wrong format. Body contains details about the error.
  • 401 - Unauthorized.
  • 500 - Internal error.

Previous Topic

Next Topic

Delete Index - DELETE

Delete an existing index in the specified table and database.

Type: DELETE

URL: /ctree/api/v1/index/{db}/{table}/{index}

Parameters:

  • db (required) - Database Name
  • table (required) - Table Name
  • index (required) - Index Name

Example:

DELETE https://localhost:8443/ctree/api/v1/index/ctreeSQL/part/name

When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.

Response:

  • 200 - OK.
  • 400 - URI is in the wrong format. Body contains details about the error.
  • 401 - Unauthorized.
  • 404 - Request cannot be satisfied because of missing resource. Body contains details about the error.
  • 500 - Internal error.

Previous Topic

Next Topic

Get Index Definition - GET

Get the definition of an index in the specified table and database.

Type: GET

URL: /ctree/api/v1/index/{db}/{table}/{index}

Parameters:

  • db (required) - Database Name
  • table (required) - Table Name
  • index (required) - Index Name

Example:

GET https://my-ctree-server:8443/ctree/api/v1/index/ctreeSQL/books/idxname

When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.

Response:

  • 200 - OK. Returns the definition of the index. Example:

{
"unique": true,
"fields": [
{
"name": "part_name",
"ascending": true
},
{
"name": "part_number",
"ascending": false
}
]
}

  • 400 - URI is in the wrong format. Body contains details about the error.
  • 401 - Unauthorized.
  • 500 - Internal error.

Previous Topic

Next Topic

Get List of Indexes on a Table - GET

Get a list of all indexes on the specified table and database.

Type: GET

URL: /ctree/api/v1/index/{db}/{table}

Parameters:

  • db (required) Database Name
  • table (required) Table Name

Example:

GET https://my-ctree-server:8443/ctree/api/v1/index/ctreeSQL/books

When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.

Response:

  • 200 - OK. Returns a list of indexes. Example:

{
"_indexes": [
name"

]
}

  • 401 - Unauthorized.
  • 500 - Internal error.

TOCIndex