Skip to main content

Insert records

Tutorial for inserting records into a table using the JSON DB API

Prerequisites

Steps

  1. Paste this code into the API Request editor.

    {
        "api": "db",
        "action": "insertRecords",
        "params": {
            "databaseName": "ctreeSQL",
            "tableName": "athlete",
            "dataFormat": "objects",
            "sourceData": [
                {
                    "name": "Michael Jordan",
                    "ranking": 1,
                    "birthDate": "19630217",
                    "playerNumber": 23,
                    "livedPast2000": true,
                    "earnings": 1700000000,
                    "favoriteSaying": "There is no 'i' in team but there is in win."
                },
                {
                    "name": "Babe Ruth",
                    "ranking": 2,
                    "birthDate": "18950206",
                    "playerNumber": 3,
                    "livedPast2000": false,
                    "earnings": 800000,
                    "favoriteSaying": "Every strike brings me closer to the next home run."
                },
                {
                    "name": "Muhammad Ali",
                    "ranking": 3,
                    "birthDate": "19420117",
                    "playerNumber": 1,
                    "livedPast2000": true,
                    "earnings": 60000000,
                    "favoriteSaying": "Float like a butterfly, sting like a bee."
                },
                {
                    "name": "Pele",
                    "ranking": 4,
                    "birthDate": "19401023",
                    "playerNumber": 10,
                    "livedPast2000": true,
                    "earnings": 115000000,
                    "favoriteSaying": "Everything is practice."
                },
                {
                    "name": "Wayne Gretzky",
                    "ranking": 5,
                    "birthDate": "19610126",
                    "playerNumber": 99,
                    "livedPast2000": true,
                    "earnings": 1720000,
                    "favoriteSaying": "You miss 100 percent of the shots you never take."
                },
                {
                    "name": "Michael Schumacher",
                    "ranking": 6,
                    "birthDate": "19690103",
                    "playerNumber": 1,
                    "livedPast2000": true,
                    "earnings": 990000000,
                    "favoriteSaying": "Once something is a passion, the motivation is there."
                }
            ]
        },
        "authToken": "clickApplyDefaultsToReplaceThisWithValidAuthToken"
    }
    
  2. Click Apply defaults to JSON request (Apply) to set the "authToken" to a valid value.

  3. Click Send request (Run Icon).

  4. Verify the action completed successfully.

    Note

    "errorCode" with a value of 0 indicates success. "errorCode" with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.