Skip to main content
PUT
/
db
/
update
JavaScript
const response = await fetch('https://api.worqhat.com/db/update', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    table: "users",
    data: {status: "active"},
    where: {id: "123"},
    environment: "production"
  })
});
const data = await response.json();
console.log(data);
{
  "success": true,
  "data": [
    {}
  ],
  "count": 123,
  "message": "Data updated successfully"
}

Authorizations

Authorization
string
header
required

API key authentication. Format - "Bearer YOUR_API_KEY"

Body

application/json
table
string
required

Table name to update

Example:

"users"

data
object
required

Data to update

Example:
{ "status": "active" }
where
object
required

Where conditions

Example:
{ "id": "123" }
environment
enum<string>

Environment to update in (development, staging, production)

Available options:
development,
staging,
production
Example:

"production"

Response

Data updated successfully

success
boolean
Example:

true

data
object[]
count
integer

Number of records updated

message
string
Example:

"Data updated successfully"