LogoLogo
Studio
4.4
4.4
  • Harper Docs
  • Getting Started
  • Developers
    • Applications
      • Caching
      • Defining Schemas
      • Defining Roles
      • Debugging Applications
      • Define Fastify Routes
      • Web Applications
      • Example Projects
    • Components
      • Managing
      • Reference
      • Built-In Components
    • REST
    • Operations API
      • Quick Start Examples
      • Databases and Tables
      • NoSQL Operations
      • Bulk Operations
      • Users and Roles
      • Clustering
        • Clustering with NATS
      • Custom Functions
      • Components
      • Registration
      • Jobs
      • Logs
      • Utilities
      • Token Authentication
      • SQL Operations
      • Advanced JSON SQL Examples
    • Real-Time
    • Replication/Clustering
      • Sharding
      • Legacy NATS Clustering
        • Requirements and Definitions
        • Creating A Cluster User
        • Naming A Node
        • Enabling Clustering
        • Establishing Routes
        • Subscription Overview
        • Managing Subscriptions
        • Things Worth Knowing
        • Certificate Management
    • Security
      • JWT Authentication
      • Basic Authentication
      • mTLS Authentication
      • Configuration
      • Users & Roles
      • Certificate Management
    • SQL Guide
      • SQL Features Matrix
      • SQL Date Functions
      • SQL Reserved Word
      • SQL Functions
      • SQL JSON Search
      • SQL Geospatial Functions
    • Miscellaneous
      • Google Data Studio
      • SDKs
      • Query Optimization
  • Administration
    • Best Practices and Recommendations
    • Logging
      • Standard Logging
      • Audit Logging
      • Transaction Logging
    • Clone Node
    • Compact
    • Jobs
    • Harper Studio
      • Create an Account
      • Log In & Password Reset
      • Organizations
      • Instances
      • Manage Databases / Browse Data
      • Manage Clustering
      • Manage Instance Users
      • Manage Instance Roles
      • Manage Applications
      • Instance Metrics
      • Instance Configuration
      • Enable Mixed Content
  • Deployments
    • Configuration File
    • Harper CLI
    • Install Harper
      • On Linux
    • Upgrade a Harper Instance
    • Harper Cloud
      • IOPS Impact on Performance
      • Instance Size Hardware Specs
      • Alarms
      • Verizon 5G Wavelength
  • Technical Details
    • Reference
      • Analytics
      • Architecture
      • Content Types
      • Data Types
      • Dynamic Schema
      • GraphQL
      • Harper Headers
      • Harper Limits
      • Globals
      • Resource Class
      • Transactions
      • Storage Algorithm
    • Release Notes
      • Harper Tucker (Version 4)
        • 4.4.24
        • 4.4.23
        • 4.4.22
        • 4.4.21
        • 4.4.20
        • 4.4.19
        • 4.4.18
        • 4.4.17
        • 4.4.16
        • 4.4.15
        • 4.4.14
        • 4.4.13
        • 4.4.12
        • 4.4.11
        • 4.4.10
        • 4.4.9
        • 4.4.8
        • 4.4.7
        • 4.4.6
        • 4.4.5
        • 4.4.4
        • 4.4.3
        • 4.4.2
        • 4.4.1
        • 4.4.0
        • 4.3.38
        • 4.3.37
        • 4.3.36
        • 4.3.35
        • 4.3.34
        • 4.3.33
        • 4.3.32
        • 4.3.31
        • 4.3.30
        • 4.3.29
        • 4.3.28
        • 4.3.27
        • 4.3.26
        • 4.3.25
        • 4.3.24
        • 4.3.23
        • 4.3.22
        • 4.3.21
        • 4.3.20
        • 4.3.19
        • 4.3.18
        • 4.3.17
        • 4.3.16
        • 4.3.15
        • 4.3.14
        • 4.3.13
        • 4.3.12
        • 4.3.11
        • 4.3.10
        • 4.3.9
        • 4.3.8
        • 4.3.7
        • 4.3.6
        • 4.3.5
        • 4.3.4
        • 4.3.3
        • 4.3.2
        • 4.3.1
        • 4.3.0
        • 4.2.8
        • 4.2.7
        • 4.2.6
        • 4.2.5
        • 4.2.4
        • 4.2.3
        • 4.2.2
        • 4.2.1
        • 4.2.0
        • 4.1.2
        • 4.1.1
        • 4.1.0
        • 4.0.7
        • 4.0.6
        • 4.0.5
        • 4.0.4
        • 4.0.3
        • 4.0.2
        • 4.0.1
        • 4.0.0
        • Tucker
      • HarperDB Monkey (Version 3)
        • 3.3.0
        • 3.2.1
        • 3.2.0
        • 3.1.5
        • 3.1.4
        • 3.1.3
        • 3.1.2
        • 3.1.1
        • 3.1.0
        • 3.0.0
      • HarperDB Penny (Version 2)
        • 2.3.1
        • 2.3.0
        • 2.2.3
        • 2.2.2
        • 2.2.0
        • 2.1.1
      • HarperDB Alby (Version 1)
        • 1.3.1
        • 1.3.0
        • 1.2.0
        • 1.1.0
  • More Help
    • Support
    • Slack
    • Contact Us
Powered by GitBook
On this page
  • Insert
  • Body
  • Response: 200
  • Update
  • Body
  • Response: 200
  • Upsert
  • Body
  • Response: 200
  • Delete
  • Body
  • Response: 200
  • Search By ID
  • Body
  • Response: 200
  • Search By Value
  • Body
  • Response: 200
  • Search By Conditions
  • Body
  • Response: 200
  1. Developers
  2. Operations API

NoSQL Operations

Insert

Adds one or more rows of data to a database table. Primary keys of the inserted JSON record may be supplied on insert. If a primary key is not provided, then a GUID or incremented number (depending on type) will be generated for each record.

  • operation (required) - must always be insert

  • database (optional) - database where the table you are inserting records into lives. The default is data

  • table (required) - table where you want to insert records

  • records (required) - array of one or more records for insert

Body

{
    "operation": "insert",
    "database": "dev",
    "table": "dog",
    "records": [
        {
            "id": 8,
            "dog_name": "Harper",
            "breed_id": 346,
            "age": 7
        },
        {
            "id": 9,
            "dog_name": "Penny",
            "breed_id": 154,
            "age": 7
        }
    ]
}

Response: 200

{
    "message": "inserted 2 of 2 records",
    "inserted_hashes": [
        8,
        9
    ],
    "skipped_hashes": []
}

Update

Changes the values of specified attributes in one or more rows in a database table as identified by the primary key. NOTE: Primary key of the updated JSON record(s) MUST be supplied on update.

  • operation (required) - must always be update

  • database (optional) - database of the table you are updating records in. The default is data

  • table (required) - table where you want to update records

  • records (required) - array of one or more records for update

Body

{
    "operation": "update",
    "database": "dev",
    "table": "dog",
    "records": [
        {
            "id": 1,
            "weight_lbs": 55
        },
        {
            "id": 2,
            "owner": "Kyle B",
            "weight_lbs": 35
        }
    ]
}

Response: 200

{
    "message": "updated 2 of 2 records",
    "update_hashes": [
        1,
        3
    ],
    "skipped_hashes": []
}

Upsert

Changes the values of specified attributes for rows with matching primary keys that exist in the table. Adds rows to the database table for primary keys that do not exist or are not provided.

  • operation (required) - must always be upsert

  • database (optional) - database of the table you are updating records in. The default is data

  • table (required) - table where you want to update records

  • records (required) - array of one or more records for update

Body

{
    "operation": "upsert",
    "database": "dev",
    "table": "dog",
    "records": [
        {
            "id": 8,
            "weight_lbs": 155
        },
        {
            "name": "Bill",
            "breed": "Pit Bull",
            "id": 10,
            "Age": 11,
            "weight_lbs": 155
        },
        {
            "name": "Harper",
            "breed": "Mutt",
            "age": 5,
            "weight_lbs": 155
        }
    ]
}

Response: 200

{
    "message": "upserted 3 of 3 records",
    "upserted_hashes": [
        8,
        10,
        "ea06fc8e-717b-4c6c-b69d-b29014054ab7"
    ]
}

Delete

Removes one or more rows of data from a specified table.

  • operation (required) - must always be delete

  • database (optional) - database where the table you are deleting records lives. The default is data

  • table (required) - table where you want to deleting records

  • ids (required) - array of one or more primary key values, which identifies records to delete

Body

{
    "operation": "delete",
    "database": "dev",
    "table": "dog",
    "ids": [
        1,
        2
    ]
}

Response: 200

{
    "message": "2 of 2 records successfully deleted",
    "deleted_hashes": [
        1,
        2
    ],
    "skipped_hashes": []
}

Search By ID

Returns data from a table for one or more primary keys.

  • operation (required) - must always be search_by_id

  • database (optional) - database where the table you are searching lives. The default is data

  • table (required) - table you wish to search

  • ids (required) - array of primary keys to retrieve

  • get_attributes (required) - define which attributes you want returned. Use ['*'] to return all attributes

Body

{
    "operation": "search_by_id",
    "database": "dev",
    "table": "dog",
    "ids": [
        1,
        2
    ],
    "get_attributes": [
        "dog_name",
        "breed_id"
    ]
}

Response: 200

[
    {
        "dog_name": "Penny",
        "breed_id": 154
    },
    {
        "dog_name": "Harper",
        "breed_id": 346
    }
]

Search By Value

Returns data from a table for a matching value.

  • operation (required) - must always be search_by_value

  • database (optional) - database where the table you are searching lives. The default is data

  • table (required) - table you wish to search

  • search_attribute (required) - attribute you wish to search can be any attribute

  • search_value (required) - value you wish to search - wild cards are allowed

  • get_attributes (required) - define which attributes you want returned. Use ['*'] to return all attributes

Body

{
    "operation": "search_by_value",
    "database": "dev",
    "table": "dog",
    "search_attribute": "owner_name",
    "search_value": "Ky*",
    "get_attributes": [
        "id",
        "dog_name"
    ]
}

Response: 200

[
    {
        "dog_name": "Penny"
    },
    {
        "dog_name": "Kato"
    }
]

Search By Conditions

Returns data from a table for one or more matching conditions. This supports grouping of conditions to indicate order of operations as well.

  • operation (required) - must always be search_by_conditions

  • database (optional) - database where the table you are searching lives. The default is data

  • table (required) - table you wish to search

  • operator (optional) - the operator used between each condition - and, or. The default is and

  • offset (optional) - the number of records that the query results will skip. The default is 0

  • limit (optional) - the number of records that the query results will include. The default is null, resulting in no limit

  • sort optional - This is an object that indicates the sort order. It has the following properties:

    • attribute (required) - The attribute to sort by

    • descending (optional) - If true, will sort in descending order (defaults to ascending order)

    • next (optional) - This can define the next sort object that will be used to break ties for sorting when there are multiple records with the same value for the first attribute (follows the same structure as sort, and can recursive additional attributes).

  • get_attributes (required) - define which attributes you want returned. Use ['*'] to return all attributes

  • conditions (required) - the array of conditions objects, specified below, to filter by. Must include one or more object in the array that are a condition or a grouped set of conditions. A condition has the following properties:

    • search_attribute (required) - the attribute you wish to search, can be any attribute

    • search_type (required) - the type of search to perform - equals, not_equal, contains, starts_with, ends_with, greater_than, greater_than_equal, less_than, less_than_equal, between

    • search_value (required) - case-sensitive value you wish to search. If the search_type is between then use an array of two values to search between Or a set of grouped conditions has the following properties:

    • operator (optional) - the operator used between each condition - and, or. The default is and

    • conditions (required) - the array of conditions objects as described above.

Body

{
    "operation": "search_by_conditions",
    "database": "dev",
    "table": "dog",
    "operator": "and",
    "offset": 0,
    "limit": 10,
    "sort": {
        "attribute": "id",
        "next": {
            "dog_name": "age",
            "descending": true
        }
    },
    "get_attributes": [
        "*"
    ],
    "conditions": [
        {
            "search_attribute": "age",
            "search_type": "between",
            "search_value": [
                5,
                8
            ]
        },
        {
            "search_attribute": "weight_lbs",
            "search_type": "greater_than",
            "search_value": 40
        },
        {
            "operator": "or",
            "conditions": [
                {
                    "search_attribute": "adorable",
                    "search_type": "equals",
                    "search_value": true
                },
                {
                    "search_attribute": "lovable",
                    "search_type": "equals",
                    "search_value": true
                }
            ]
        }
    ]
}

Response: 200

[
    {
        "__createdtime__": 1620227719791,
        "__updatedtime__": 1620227719791,
        "adorable": true,
        "age": 7,
        "breed_id": 346,
        "dog_name": "Harper",
        "id": 2,
        "owner_name": "Stephen",
        "weight_lbs": 55
    },
    {
        "__createdtime__": 1620227719792,
        "__updatedtime__": 1620227719792,
        "adorable": true,
        "age": 7,
        "breed_id": 348,
        "dog_name": "Alby",
        "id": 3,
        "owner_name": "Kaylan",
        "weight_lbs": 84
    },
    {
        "__createdtime__": 1620227719792,
        "__updatedtime__": 1620227719792,
        "adorable": true,
        "age": 6,
        "breed_id": 347,
        "dog_name": "Billy",
        "id": 4,
        "owner_name": "Zach",
        "weight_lbs": 60
    },
    {
        "__createdtime__": 1620227719792,
        "__updatedtime__": 1620227719792,
        "adorable": true,
        "age": 5,
        "breed_id": 250,
        "dog_name": "Gemma",
        "id": 8,
        "owner_name": "Stephen",
        "weight_lbs": 55
    },
    {
        "__createdtime__": 1620227719792,
        "__updatedtime__": 1620227719792,
        "adorable": true,
        "age": 8,
        "breed_id": 104,
        "dog_name": "Bode",
        "id": 11,
        "owner_name": "Margo",
        "weight_lbs": 75
    }
]
PreviousDatabases and TablesNextBulk Operations

Last updated 9 days ago