Data Browser

Data Browser is a tool to browse your application data on the developer portal. It allows you to browse and edit data in buckets.

Opening the data browser

You can open the data browser with the following steps:

  1. Select the application on the developer portal.
  2. Click the "Objects" icon.
  3. Click "Data Browser".

This will bring up the initial screen like below.

Managing buckets

The following features are available in the data browser:

Adding a new bucket

  1. Select "Normal bucket" for the bucket type.
  2. Select the bucket scope.

    • If you are selecting a group-scope, select the target group.
    • If you are selecting a user-scope, select the target user. You can select how you want to specify the target user.
    • If you are selecting a thing-scope, select the target thing. You can select how you want to specify the target thing.

    In all the cases, a drop-down with a list of target candidates will show up as you type in the value. If the drop-down does not show up, try clearing the input and enlarging the size of the browser.

  3. A list of existing buckets in the scope is displayed.

  4. Type in the bucket name in the search box and press "+Add" button.

    The newly created bucket will appear on the list.

Browsing an existing bucket

  1. Select "Normal bucket" for the bucket type.
  2. Select the bucket scope.

    • If you are selecting a group-scope, select the target group.
    • If you are selecting a user-scope, select the target user. You can select how you want to specify the target user.
    • If you are selecting a thing-scope, select the target thing. You can select how you want to specify the target thing.

    In all cases, a drop-down with a list of target candidates will show up as you type in the value. If the drop-down does not show up, try clearing the input and enlarging the size of the browser.

  3. Once you select the scope, you will see a list of buckets in the scope like below.

    By default, all available buckets will be listed. You can optionally filter the list by entering some text in the search textbox.

  4. Click the target bucket in the list. You will see a list of all KiiObjects in the bucket like below.

Up to 200 KiiObjects will be listed at the start. If you have more KiiObjects, just scroll down the list to the bottom to bring up the next 200 KiiObjects. The list can extend up to 1000 KiiObjects.

To browse and edit a KiiObject, simply click it in the list. See Managing KiiObjects for more information.

If the application data is not shown properly, check if you are querying the correct scope (See here for more discussion).

Customizing the keys to show

By default, the list only shows the predefined keys like "_id" and "_created" (See here for the details on these predefined keys). You can customize the keys to show by clicking the "Columns" button and by toggling key names.

Adding custom queries

By default, all KiiObjects in a bucket will be listed. You can add custom queries to filter the KiiObject list.

  1. Press the "Add Query" button.

  2. The query builder opens like below.

    Define your custom query by filling in the following information:

    • Query name: The name of your custom query. This name will be later used as the tab name.
    • All/Any: The selector to define how multiple query conditions are to be evaluated.
      • All: Concatenate all query conditions with a logical "AND" operator.
      • Any: Concatenate all query conditions with a logical "OR" operator.
    • Query condition(s): The filtering condition. Click the plus sign (+) to add more condition. Click the minus sign (-) to remove a condition.

      You can specify one of the following query clauses:

      • "is" or "is not" clause

        Check if the given key has or does not have the given value (with the given data type), respectively. This clause is available for String, Integer, Decimal, and Boolean.

        For example, the above query conditions will match with all KiiObjects that have the key "name" with the value "John Doe" AND the key "age" with the value other than 30.

      • "begins with" clause

        Check if the given key starts with the specified string. This clause is only available for String.

        For example, the above query condition will match with all objects that have the key "name" with the value starting with "Jo".

      • "is greater than (>)", "is greater than or equal to (≥)", "is less than (<)" or "is less than or equal to (≤)" clause

        Compare the given key with the given value. This clause is available for Integer, Decimal and "Date and Time".

        For example, the above query condition will match with all objects that have the key "age" greater than 20.

        This is another example. In this case, the query will match with all objects that have the key "date" before 2014-10-01 00:00:00.

      • "is between" clause

        Check if the given key is in between the given values. This clause is available for Integer, Decimal, and "Date and Time". The first value is "from" and the second value is "to".

        For example, the above query condition will match with all objects having their "age" in between 20 and 50 (inclusive).

      • "is in" clause

        Check if the given key has one of the given values. Please use commas to separate the values (spaces before and after the comma will be ignored). The clause is available for String, Integer, and Decimal.

        For example, the above query condition will match with all objects with their "city" either "New York", "Tokyo" or "Beijing".

      • "is of type" clause

        Check if the given key has the given data type. This clause is available for String, Integer, Decimal, and Boolean.

        For example, the above query condition will match with all objects with their "paid" having the boolean value.

  3. When you are done with defining your custom query, click the "Save" button.

    Once the custom query is saved, the corresponding tab will appear in the data browser. You can apply the custom query anytime by clicking on the tab.

Editing and deleting a custom query

To edit the existing custom query, select the target query tab and click on the "Edit Query" button.

This will bring up the query builder.

  • If you are editing the query, make the necessary updates and press the "Save" button when done.
  • If you are deleting the query, press the "Delete" button.

Deleting an existing bucket

  1. Select "Normal bucket" for the bucket type.
  2. Select the bucket scope.

    • If you are selecting a group-scope, select the target group.
    • If you are selecting a user-scope, select the target user. You can select how you want to specify the target user.
    • If you are selecting a thing-scope, select the target thing. You can select how you want to specify the target thing.

    In all cases, a drop-down with a list of target candidates will show up as you type in the value. If the drop-down does not show up, try clearing the input and enlarging the size of the browser.

  3. Once you select the scope, you will see a list of buckets in the scope like below.

    By default, all available buckets will be listed. You can optionally filter the list by entering some text in the search textbox.

  4. Click the target bucket in the list. You will see a list of all KiiObjects in the bucket.

  5. Click the gear icon at the upper-right corner of the object list screen and select "Delete Bucket".

    The confirmation dialog will show up. Select "Delete" to delete the bucket.

Once the bucket is deleted, all KiiObjects in the bucket will be also deleted.

Changing an existing bucket's ACL

  1. Select "Normal bucket" for the bucket type.
  2. Select the bucket scope.

    • If you are selecting a group-scope, select the target group.
    • If you are selecting a user-scope, select the target user. You can select how you want to specify the target user.
    • If you are selecting a thing-scope, select the target thing. You can select how you want to specify the target thing.

    In all cases, a drop-down with a list of target candidates will show up as you type in the value. If the drop-down does not show up, try clearing the input and enlarging the size of the browser.

  3. Once you select the scope, you will see a list of buckets in the scope like below.

    By default, all available buckets will be listed. You can optionally filter the list by entering some text in the search textbox.

  4. Click the target bucket in the list. You will see a list of all KiiObjects in the bucket.

  5. Click the gear icon at the upper-right corner of the object list screen and select "ACL".

    This will bring you to the "Bucket ACL Settings" screen.

  6. Select the "Action" to check or update.

    For the details of each action, see "Bucket Access Control" (Android, iOS, JavaScript, REST).

    Selecting the action will bring up the current ACL settings on the action.

  7. Click the toggle buttons to change the permission granted to "Anonymous User" and "Any Authenticated User".

    See "Subject" (Android, iOS, JavaScript, REST) for the details of "Anonymous User" and "Any Authenticated User".

  8. To add a new ACL entry, specify the target by selecting the target type (User ID, Group ID, or Thing ID) and by typing their ID.

    Pressing the "+Grant" button will create the new ACL entry and grant the permission to the specified target.

  9. To revoke an existing ACL entry, select the target ACL entry and press the "-Revoke" button.

    Note that some ACL entries cannot be revoked. See "Cannot delete default ACL entries of scope owners and creators" (Android, iOS, JavaScript, REST) for more information.

Managing KiiObjects

The following features are available in the data browser:

Adding and updating a KiiObject

Clicking the "Add Object" button will bring up the empty object editor (Note that you can click the button only in the "All" tab).

Clicking a KiiObject in the list will bring up the KiiObject editor with the current key-value pairs in the KiiObject.

In both cases, you can edit the KiiObject by directly updating the JSON document.

If the edited JSON document is invalid, an error message will be displayed like the following example.

If you are creating a new KiiObject, you can optionally set its ID.

When you are done with the editing, press the "Save" button.

Deleting a KiiObject

You can delete a KiiObject by pressing the "Delete" button on the object editor.

You can also delete multiple KiiObjects simultaneously by selecting them in the list and by pressing the "Delete Objects" button.

You can delete up to 50 KiiObjects at the same time.

Managing object bodies

Clicking the "Body" tab will show the object body console.

Uploading an object body

To upload an object body, select the target file and click the "Upload" button.

Downloading an object body

To download an object body, click the "Download" button. The button is only available when you are opening a KiiObject with an object body.

Deleting an object body

To delete an object body, click the "Delete" button. The button is only available when you are opening a KiiObject with an object body.

Publishing an object body

To publish an object body, click the "Generate URL" button. The button is only available when you are opening a KiiObject with an object body.

When the object body is published, the URL for accessing it will be displayed.

The data browser does not preserve the URL. When you refresh the browser, for example, you have no way to check the URL again (the URL itself is still valid, and you can access the object body with the URL).

When publishing an object body, you can optionally set an expiration time using either of the following methods:

  • The time when the URL will be expired such as March 31, 2099.
  • The lifetime of the URL such as one hour from now.

Importing and exporting data

The following features are available in the data browser:

Importing data

To import data, select the target bucket and press the "Data Import" button.

Select the import file and press the "Import" button. The import starts.

You can select the following three options when importing data:

  • Treat all fields as String: When enabled, all values are treated as String.
  • Bucket recreation: When enabled, all existing data in the bucket are erased before importing the data.
  • Create / Update objects with _id: When enabled, KiiObjects will be created/updated with the specified ID.

Format of the import file

The import file must be in the CSV or TSV format. It will be treated as UTF-8 encoded data.

The data browser reads the data as follows:

  • The first line is treated as the header.

    • The values in the line are treated as keys for the key-value pairs in KiiObjects.
    • If you set the option "Create / Update objects with _id", add "_id" in the first line as well (Note: any fields starting with "_" other than "_id" will be ignored).
  • The second and subsequent lines are treated as values for the key-value pairs in KiiObjects.

    • Each line corresponds to one KiiObject; the values in a line are treated as values for the key-value pairs in a KiiObject.
    • The values are parsed as JSON data by default unless the option "Treat all fields as String" is enabled.
    • If you set the option "Create / Update objects with _id", set the KiiObject ID as well. A new KiiObject will be created if no KiiObject with the specified ID exists; otherwise, the existing KiiObject will be overwritten with the specified values.

Example #1

Suppose that the import file contains the following data:

name,surname,size
John,Doe,999
Jane,Doe,888

This file will create the following two KiiObjects in the target bucket:

[
  {
    "name": "John",
    "surname": "Doe",
    "size": 999
  },
  {
    "name": "Jane",
    "surname": "Doe",
    "size": 888
  }
]

Example #2

Here is more complex example:

hello,cruel,world
"{ ""someobj"" : [ 1, 2, 3, null ] }",123,
true,false,null
"""true""","""false""","""null"""

This will create the following KiiObjects:

[
  {
    "hello": {
      "someobj": [
        1,
        2,
        3,
        null
      ]
    },
    "cruel": 123,
    "world": ""
  },
  {
    "hello": true,
    "cruel": false,
    "world": null
  },
  {
    "hello": "true",
    "cruel": "false",
    "world": "null"
  }
]

Exporting data

You can export data as a CSV file. All KiiObjects in the target bucket that match with the active query will be exported.

To export data, select the target bucket, filter KiiObject by applying an appropriate custom query (if needed), and press the "Data Export" button.

You will be prompted to select where to save the CSV file.

The file is UTF-8 encoded. Its filename will be "{Bucket Name}.csv".

Format of the export file

The export file will be in the following format (basically the format is the same as that of the import file):

  • The first line will be the header that contains all the keys.

    • Custom keys are listed in alphabetical order.
    • Predefined keys set by Kii Cloud (e.g., _created and _id) are listed after the custom keys.
  • The values for each KiiObject are dumped in the second and subsequent lines. Each line represents one KiiObject.

    • A string value will be quoted.
    • A JSON value will be flattened.

Example #1

For example, suppose that you export the following two KiiObjects:

{
    "name": "Michael",
    "surname": "Jackson",
    "size": 999
},
{
    "name": "Johnny",
    "surname": "Depp",
    "size": 888,
    "pirates": true
}

The exported file will be like this:

name,pirates,size,surname,_created,_id,_modified,_owner,_version
"""Johnny""",true,888,"""Depp""",1440058127729,"""af18ce10-4712-11e5-87ed-123143052eaa""",1440058127729,"""bb2f192b159c0743a97b066cfd190ba2""","""1"""
"""Michael""",,999,"""Jackson""",1440058111051,"""a527f1b0-4712-11e5-87ed-123143052eaa""",1440058111051,"""bb2f192b159c0743a97b066cfd190ba2""","""1"""

Example #2

Here is another example:

{
  "hello": {
    "someobj": [
      1,
      2,
      3,
      null
    ]
  },
  "cruel": 123,
  "world": ""
},
{
  "hello": true,
  "cruel": false,
  "world": null
},
{
  "hello": "true",
  "cruel": "false",
  "world": "null"
}

The exported file will be like this:

cruel,hello,world,_created,_id,_modified,_owner,_version
123,"{""someobj"":[1,2,3,null]}","""""",1440057447395,"""c63da810-470b-11e5-87ed-123143052eaa""",1440057447395,"""bb2f192b159c0743a97b066cfd190ba2""","""1"""
false,true,null,1440057447135,"""f02902a0-470b-11e5-87ed-123143052eaa""",1440057447135,"""bb2f192b159c0743a97b066cfd190ba2""","""1"""
"""false""","""true""","""null""",1440057446835,"""f97c8d90-470b-11e5-a7dc-123143051a24""",1440057471951,"""bb2f192b159c0743a97b066cfd190ba2""","""2"""