アプリのデータベースを生成するためのAPIです。

CreateAppData

アプリケーションでスキーマ定義したテーブルをサーバーサイドに作成します。
アプリケーションはサーバーサイドで作業する事なく、クライアントSDK側でスキーマを定義しておくだけで、本API呼び出し時に自動的にテーブルが生成されます。

処理シーケンス

  1. ユーザセッションと対象アプリケーションの妥当性を検証し、不正な場合はエラーを返します。
  2. 指定されたアプリケーションテーブルのスキーマ定義が不正であればエラーを返します。
  3. isResetDatabaseパラメータがtrueの場合は、常にテーブルを作成します。
  4. isResetDatabaseパラメータがfalseの場合は、テーブルが存在していなければテーブルを作成します。

URL

  • POST
    http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/schemas
    

Authentication

匿名トークンを必要とします。

Content-Type: application/json
apppot-token: token

Name Data Format Description
apppot-token String (Required) Login APIの結果得られたユーザートークン

Request parameters

Name Data Format Description
appId String (Required) appId
appVersion String (Required) app version
isResetDatabase boolean (Required) true/false
tables List<AppTable> (Required) Table list of client database
companyId long (Required) companyId of user
Name Data Format Description
name String (Required) Name of table
columns List<AppColumn> (Required) Column list
primary_key String Always is objectId
Name Data Format Description
colName String (Required) Column name
type String (Required) Data type of colum。varchar/integer/longを指定できます。
fieldLength int (Optional) Length of varchar data type column - Need when want to set that column unique

Request example

{
  "appId":"app.thai",
  "appVersion":"1.0",
  "isResetDatabase": true,
  "companyId": 1,
   "tables":[
      {
         "primary_key":"objectId",
         "name":"department",
         "columns":[
            {
               "colName":"UpdateTime",
               "type":"long"
            },
            {
               "colName":"CreateTime",
               "type":"long"
            },
            {
               "colName":"isHave",
               "type":"integer"
            },
            {
               "colName":"nameOfDepart",
               "type":"varchar",
               "fieldLength": 255
            },
            {
               "colName":"objectId",
               "type":"varchar"
            },
            {
               "colName":"scopeType",
               "type":"varchar"
            }
         ]
      }
   ]
}
Response example
{
    "errCode": 0,
    "status": "OK",
    "description": null,
    "result": null
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 103, 105, 106, 109, 120, 121, 198
status String (Required) API result status value.
description String (Optional) Detail status if error.

CreateAppEntities

Create application client database if not exist, update database table if DB existed

URL

  • POST
    http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/CreateAppEntities
    

Authentication

匿名トークンを必要とします。

Header

Content-Type: application/json

Request parameters

Name Data Format Description
authToken String (Required) Token
appId String (Required) appId
appVersion String (Required) app version
tables List<AppTable> (Required) Table list of client database
companyId long (Required) companyId of user
Name Data Format Description
name String (Required) Name of table
columns List<AppColumn> (Required) Column list
primary_key String Always is objectId
Name Data Format Description
colName String (Required) Column name
type String (Required) Data type of column
fieldLength int (Optional) Length of varchar data type column - Need when want to set that column unique

Request example

{
  "appId":"app.thai",
  "appVersion":"1.0",
  "authToken": "d46626e05c4e4fa38cc8bbd30ba98cbd",
  "companyId": 1,
   "tables":[
      {
         "primary_key":"objectId",
         "name":"department",
         "columns":[
            {
               "colName":"UpdateTime",
               "type":"long"
            },
            {
               "colName":"CreateTime",
               "type":"long"
            },
            {
               "colName":"isHave",
               "type":"integer"
            },
            {
               "colName":"nameOfDepart",
               "type":"varchar",
               "fieldLength": 255
            },
            {
               "colName":"objectId",
               "type":"varchar"
            },
            {
               "colName":"scopeType",
               "type":"long"
            }
         ]
      }
   ]
}

Response example

{
    "errCode": 0,
    "status": "OK",
    "description": null,
    "result": null
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 103, 105, 106, 109, 120, 121, 198
status String (Required) API result status value.
description String (Optional) Detail status if error.

Check app data

Server checks app id and app version is exist in
server side or not. If client’s app database is exist with provide app
id and app version, server return
YES if it is exist, NO if it is not created
yet.

URL

  • GET
    http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/schemas?appId=xxx&appVersion=xxx&companyId=xxx
    

Authentication

匿名トークンを必要とします。

Header

Content-Type: application/json

Request parameters

Name Data Format Description
appId String (Required) app id
appVersion String (Required) app version
companyId long (Required) companyId

Response example

{
    "status": "YES",
    "description": "",
    "results": null
}

Response properties

Name Data Format Description
errCode int Response error code: 0
status String YES or NO
Description String Description