Add Rows

post

/mobile/platform/database/objects/{table}

Adds one or more rows to the database table.

When the Database_CreateTablesPolicy environment policy is allow, then the following actions can occur:

  • If the table doesn't exist, then it's created.
  • If a column doesn't exist, then the table is altered to include it.
  • If the value is larger than the column size, then the column is resized. String values can't exceed 4000 characters.
Binary types aren't supported.

For security reasons, you can call this operation only from custom API implementations by using the custom code SDK. You can't make direct requests from client applications. This API is included in this reference merely to describe the request and response bodies for the custom code SDK calls.

Request

Supported Media Types
Path Parameters
Header Parameters
  • For an implicit table creation, optionally provide a comma-separated list that specifies which predefined columns to include in the table from amongst id, createdBy, createdOn, modifiedBy, and modifiedOn. For example, createdOn,createdBy.

    To not include any predefined columns, specify none. To include all the predefined columns, do not include the header in the request. Note that the id column is added to the table automatically if both the Oracle-Mobile-Primary-Keys and Oracle-Mobile-Extra-Fields are absent.

    When you use /mobile/platform/database/objects/{table} endpoint operations to add or modify a row in a table that has predefined columns, the predefined columns are updated automatically. The user doesn't need to provide values for these columns.

  • For an implicit table creation, provide a URL-encoded, comma-separated list specifying which attributes of the JSON object in the request body constitute the table's primary key. For example, lastName,firstName. Note that when you retrieve, update, or delete rows in a table you must specify the keys in the same order that you specified when you first created or re-created the table. However, when you call either GET /mobile/system/databaseManagement/tables or GET /mobile/system/databaseManagement/tables/{table}, the primaryKeys property lists the columns in alphabetical order, and not in the order that you used when you created or re-created the table. Therefore, you must make a note of the order when you create or re-create a table.

    If you don't specify a primary key and you don't specify additional fields, then MCS adds an id column to the table, and generates the column's values automatically.

Body ()
Root Schema : Added or Updated Items
Type: object
Title: Added or Updated Items
Match One
Show Source
  • Columns
    Title: Columns
    Additional Properties Allowed: additionalProperties
    Column names and values. For example `{ "title" : "The Imitation Game"}`. String values can't exceed 4000 characters. Binary types aren't supported.
  • Table Data
    Title: Table Data
    Minimum Number of Items: 1
    Unique Items Required: true
Nested Schema : Columns
Type: object
Title: Columns
Additional Properties Allowed
Show Source
Column names and values. For example `{ "title" : "The Imitation Game"}`. String values can't exceed 4000 characters. Binary types aren't supported.
Nested Schema : Table Data
Type: array
Title: Table Data
Minimum Number of Items: 1
Unique Items Required: true
Show Source
  • Columns
    Title: Columns
    Additional Properties Allowed: additionalProperties
    Column names and values. For example `{ "title" : "The Imitation Game"}`. String values can't exceed 4000 characters. Binary types aren't supported.
Example Request (application/json)
[
    {
        "title":"Fear",
        "year":1954
    },
    {
        "title":"Annie",
        "year":1982
    }
]
Back to Top

Response

Supported Media Types

200 Response

The structure of the response JSON object depends on if the table has a primary key:

Example when the table has a primary key:

{ "rowCount" : 2 } 
Example when the row key is the id column:
{"items":[{"id":42},{"id":43}]} 

Body ()
Root Schema : Add, Update, or Delete Response
Type: object
Title: Add, Update, or Delete Response
Match One
Show Source
Nested Schema : Row Count
Type: object
Title: Row Count
Show Source
Nested Schema : Added, Updated, or Deleted Items
Type: object
Title: Added, Updated, or Deleted Items
IDs for the rows that were added, updated, or deleted.
Show Source
Nested Schema : Row Data
Type: array
Title: Row Data
Minimum Number of Items: 0
Unique Items Required: true
Show Source
Nested Schema : ID
Type: object
Title: ID
Show Source

400 Response

The request failed. This is typically because the request body is not well-formed JSON or the row already exists.

Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Back to Top