Skip to content

Ejemplos con curl

SELECT

bash
curl -X POST https://celdrax.com/api/midb/usuarios \
  -H "Authorization: Bearer cxk_tu_token_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "verb": "select",
    "filters": { "active": true },
    "limit": 10
  }'

SELECT — columnas específicas

bash
curl -X POST https://celdrax.com/api/midb/productos \
  -H "Authorization: Bearer cxk_tu_token_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "verb": "select",
    "columns": ["id", "nombre", "precio"],
    "orderBy": "precio DESC",
    "limit": 5
  }'

INSERT

bash
curl -X POST https://celdrax.com/api/midb/usuarios \
  -H "Authorization: Bearer cxk_tu_token_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "verb": "insert",
    "data": {
      "email": "alice@example.com",
      "nombre": "Alice",
      "active": true
    }
  }'

UPDATE

bash
curl -X POST https://celdrax.com/api/midb/usuarios \
  -H "Authorization: Bearer cxk_tu_token_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "verb": "update",
    "data":    { "active": false },
    "filters": { "id": 42 }
  }'

DELETE

bash
curl -X POST https://celdrax.com/api/midb/sesiones \
  -H "Authorization: Bearer cxk_tu_token_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "verb": "delete",
    "filters": { "user_id": 42 }
  }'

Guardar el token en una variable de entorno

bash
export CELDRAX_TOKEN="cxk_tu_token_aqui"

curl -X POST https://celdrax.com/api/midb/usuarios \
  -H "Authorization: Bearer $CELDRAX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "verb": "select", "limit": 5 }'