新しいレコードを追加する

アプリケーションデータのレコードを新規に追加します。
複数レコードを一括で追加することも可能です。

URL

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

Authentication

ユーザー認証が完了している必要があります。

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

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

Request parameters

Name Data Format Description
transactionId String (Optional) transaction id
objectName String (Required) table name
data String (Required) value of inserted record

Request example

{
"data": [
     {
       "objectId":"sdiufhisdufhksdf",
       "CreateTime":"1390085336544",
       "UpdateTime":"123546512.1245",
       "nameOfDepart":"This is depart 1",
       "isHave":"1",
       "scopeType":"2",    //1: User, 2: Group, 3: All
       "groupIds":"1"
    },
    {
       "objectId":null,
       "CreateTime":"1390085356736544",
       "UpdateTime":"1235465167821245",
       "nameOfDepart":null,
       "isHave":"2",
       "scopeType":"2",
       "groupIds":"2"
    }
],
"transactionId": "deviceUDID_20142305104705.550",
"objectName":"department"
}

Response example

  {
    "errCode": 0,
    "status": "OK",
    "description": null,
    "results": [
        {
            "objectId": "department_1390463076564",
            "serverCreateTime": "2014-01-23T14:44:36.516+07:00",
            "serverUpdateTime": "2014-01-23T14:50:43.035+07:00"
        },
        {
            "objectId": "department_1390463076611",
            "serverCreateTime": "2014-01-23T14:44:36.567+07:00",
            "serverUpdateTime": "2014-01-23T14:50:43.067+07:00"
        }
    ]
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 102, 110, 120, 121, 131, 210, 211, 212
status String OK or error
description String Error’s description
results String Object ids which are separated by comma. If object is error, object id is -1.

既存のレコードを更新する

アプリケーションデータのレコードを更新します。
複数レコードを一括で更新することも可能です。

処理シーケンス

  1. ユーザセッションと対象アプリケーションの妥当性を検証し、不正な場合はエラーを返します。
  2. 処理履歴から、既に処理済みのトランザクションIDかを検証し、処理済みであればエラーを返す。
  3. 登録データに不正なデータ構成がないかを検証し、不正な場合はエラーを返します。
  4. 楽観的排他チェックを実施、更新が競合していればエラーを返します。
  5. 対象テーブルのデータを更新します。
  6. トランザクションIDを処理履歴に登録します。

URL

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

Authentication

ユーザー認証が完了している必要があります。

Header

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

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

Request parameters

Name Data Format Description
transactionId String (Optional) transaction id
objectName String (Required) table name
data String (Required) value of updated record

Request example

{
"data": [
      {
        "objectId":"department_1390463076564",
        "CreateTime":"1390085336544",
        "UpdateTime":"1235465121245",
        "nameOfDepart":"Edited object 44",
        "isHave":"1",
        "serverUpdateTime":"2014-01-23T14:44:36.516+07:00"
     },
     {
        "objectId":"department_1390463076611",
        "CreateTime":"1390085356736544",
        "UpdateTime":"1235465167821245",
        "nameOfDepart":"Edited object",
        "isHave":"2",
        "serverUpdateTime":"2014-01-23T14:44:36.567+07:00"
     }
],
   "transactionId": "deviceUDID_20142305104705.550",
   "objectName":"department"
}

Response example

{
    "errCode": 0,
    "status": "OK",
    "description": null,
    "results": [
        {
            "objectId": "department_1390463076564",
            "serverCreateTime": "2014-01-23T14:44:36.516+07:00",
            "serverUpdateTime": "2014-01-23T14:50:43.035+07:00"
        },
        {
            "objectId": "department_1390463076611",
            "serverCreateTime": "2014-01-23T14:44:36.567+07:00",
            "serverUpdateTime": "2014-01-23T14:50:43.067+07:00"
        }
    ]
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 102, 110, 120, 121, 130, 131, 210, 211, 212
status String OK or error
description String Error’s description
results String Object ids which are separated by comma. If object is error, object id is -1.

既存のレコードを削除する

サロゲートキーによるアプリケーションデータの削除を行います。 複数レコードを一括で削除することも可能です。

処理シーケンス

  1. ユーザセッションと対象アプリケーションの妥当性を検証し、不正な場合はエラーを返します。
  2. 処理履歴から、既に処理済みのトランザクションIDかを検証し、処理済みであればエラーを返す。
  3. 楽観的排他チェックを実施、更新が競合していればエラーを返します。
  4. 対象テーブルのデータを削除します。
  5. トランザクションIDを処理履歴に登録します。

URL

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

Authentication

ユーザー認証が完了している必要があります。

Header

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

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

Request parameters

Name Data Format Description
transactionId String (Optional) transaction id
objectName String (Required) table name
objectIds String (Required) id of table

Request example

{
   "transactionId": "deviceUDID_20142305104705.550",
   "objectIds":[
       {
            "objectId": "department_1390444506968",
            "serverUpdateTime": "2014-01-23T14:33:26.152+07:00"
        },
        {
            "objectId": "department_1390444507770",
            "serverUpdateTime": "2014-01-23T14:33:26.222+07:00"
        }
   ],
   "objectName":"department"
}

Response example

{
    "errCode": 0,
    "status": "OK",
    "description": null,
    "results": [
        {
            "objectId": "department_1390444506118",
            "serverCreateTime": "2014-01-23T09:35:06.044+07:00",
            "serverUpdateTime": "2014-01-23T09:35:06.044+07:00"
        },
        {
            "objectId": "department_1390444507490",
            "serverCreateTime": "2014-01-23T09:35:07.489+07:00",
            "serverUpdateTime": "2014-01-23T09:35:07.489+07:00"
        }
    ]
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 110, 120, 121, 130, 198, 202, 210, 211, 212, 220
status String OK or error
description String Error’s description
results String Object ids which are separated by comma.