Skip to main content

POST Endpoints

Insert one or more records into a table in a single request:

POSThttps://demo.littlebit.in:443/minimal/api/rest/auto/v1/btec/tst/ms//
📋 Schema — demo_db.users
-- demo_db.users schema
CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  email VARCHAR(100) NOT NULL UNIQUE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB;
curl --location 'https://demo.littlebit.in:443/minimal/api/rest/auto/v1/btec/tst/ms/demo_db/users' \
  --header 'X-Org-Id: 01KKBPGAE4CR13W14E4T4ACSAB' \
  --header 'X-Project-Id: 01KF6G55AK87WWGQ145SDA2AC9' \
  --header 'X-Space-Id: 01KF6G55AK87WWGQ145SDA25X9' \
  --header 'X-User-Id: 01KBY3K9NDC5XW523M2V1Z0373' \
  --header 'X-User-Roles: users, admin' \
  --data '[{
  "id":10,
  "name": "Alice",
  "email": "alice@example.com"
}]'
// Hit "Send POST" to see the live response
URL Structure
/v1/acme/demo/ms/demo_db
│ │ │ │
│ │ │ └── database name
│ │ └── ms = MySQL
│ └── project abbreviation
└── org abbreviation

Request Body

Send an array of JSON objects — even for a single row, always wrap in []. All NOT NULL columns without a default are required in every object.

FieldTypeRequiredDescription
idinteger✅ YesMust be unique — no auto-increment on bulk insert
namestring✅ YesFull name of the user
emailstring✅ YesEmail address — must be unique across all rows

Insert a single row:

[
{
"id": 9,
"name": "Alice",
"email": "alice@example.com"
}
]

Insert multiple rows:

[
{
"id": 9,
"name": "Alice",
"email": "alice@example.com"
},
{
"id": 10,
"name": "Bob",
"email": "bob@example.com"
},
{
"id": 11,
"name": "Carol",
"email": "carol@example.com"
}
]

Response

201 Created — returns the number of rows successfully inserted:

{
"rows_affected": 3
}
note

If any row in the array violates a constraint (duplicate id, duplicate email, null in a required field), the entire batch is rolled back and no rows are inserted. Fix the offending row and resubmit the full array.

Required Headers

All requests to Minimal must include these headers.

They are mandatory — missing any header results in a 400 Bad Request.

HeaderFormatDescription
X-Org-IdStringOrganization identifier
X-Project-IdStringProject identifier within the organization
X-Space-IdStringWorkspace/environment identifier within the project
X-User-IdStringAuthenticated user's identifier
X-User-RolesComma-separated stringUser's roles (e.g., admin,editor)

Common Errors

CodeReason
400Body is not a valid JSON array, or is an empty array []
401Missing required header
409Duplicate id or email — either within the batch itself or against existing rows
422Schema violation — null in a NOT NULL column, wrong type, or value exceeds column length