soul

Rows

1. List Rows of a Table

To list all (or some of) rows we simply call /tables/<table-name>/rows/ endpoint with GET method.

curl 'localhost:8000/api/tables/Album/rows/'

Response

{
  "data": [
    {
      "AlbumId": 1,
      "Title": "For Those About To Rock We Salute You",
      "ArtistId": 1
    },
    { "AlbumId": 2, "Title": "Balls to the Wall", "ArtistId": 2 }
    // ...
  ],
  "total": 347,
  "next": "/tables/Album?page=2",
  "previous": null
}

Query Params

Example with query params

curl 'localhost:8000/api/tables/Album/rows?_page=1&_limit=20&_search=rock&_ordering=-Title&_schema=Title,ArtistId&_extend=ArtistId&_filters=ArtistId:90'

Response

{
  "data": [
    {
      "Title": "Rock In Rio [CD2]",
      "ArtistId": 90,
      "ArtistId_data": { "ArtistId": 90, "Name": "Iron Maiden" }
    },
    {
      "Title": "Rock In Rio [CD1]",
      "ArtistId": 90,
      "ArtistId_data": { "ArtistId": 90, "Name": "Iron Maiden" }
    }
  ],
  "total": 2,
  "next": null,
  "previous": null
}

2. Insert a New Row

To insert a new row to a table call /tables/<table-name>/rows/ endpoint with POST method.

curl --request POST \
  --url http://localhost:8000/api/tables/Employee/rows \
  --header 'Content-Type: application/json' \
  --data '{
	"fields": {
		"FirstName": "Damien",
		"LastName": "Rice"
	}
}'

Response

{
  "message": "Row inserted",
  "data": {
    "changes": 1,
    "lastInsertRowid": 9
  }
}

Body Params

"fields": {
    // fields values for the new row
}

3. Get Row(s) by ID

To get a row call /tables/<table-name>/rows/<lookup-values>/ endpoint with GET method.

curl http://localhost:8000/api/tables/Album/rows/1/

Response

{
  "data": {
    "AlbumId": 1,
    "Title": "For Those About To Rock We Salute You",
    "ArtistId": 1
  }
}

Path Params

Query Params

Example with query params

curl 'http://localhost:8000/api/tables/Album/rows/Facelift?_lookup_field=Title&_extend=ArtistId&_schema=Title'

Response

{
  "data": {
    "Title": "Facelift",
    "ArtistId_data": {
      "ArtistId": 5,
      "Name": "Alice In Chains"
    }
  }
}

4. Update Row(s) by ID

To update a row call /tables/<table-name>/rows/<lookup-values>/ endpoint with PUT method.

curl --request PUT \
  --url http://localhost:8000/api/tables/Album/rows/7 \
  --header 'Content-Type: application/json' \
  --data '{
	"fields": {
		"Title": "FaceElevate"
	}
}'

Response

{
  "message": "Row updated"
}

Path Params

Query Params

Body Params

"fields": {
    // fields values to update
}

5. Delete Row(s) by ID

To delete a row call /tables/<table-name>/rows/<lookup-values>/ endpoint with DELETE method.

curl --request DELETE \
  --url http://localhost:8000/api/tables/PlaylistTrack/rows/1

Response

{
  "message": "Row deleted",
  "data": {
    "changes": 3290,
    "lastInsertRowid": 0
  }
}

Path Params

Query Params