DataAbstract and new HttpApi

Hello

The sample server is attached: REST_SampleServer.zip (50.0 KB)

It uses the standart sample SQLite database shipped with Data Abstract.


Accessing a table:

GET http://localhost:8099/rest/Customers

Accessing a table with some condition applied:

GET http://localhost:8099/rest/Customers?filter=Name%20LIKE%20%27%An%%27

Accessing single record in the table:

GET http://localhost:8099/rest/Customers/{3217032b-47db-400a-9a6e-012cbdf1e1e5}

Inserting a row

POST http://localhost:8099/rest/Customers

with a body like

{"Id":"{11111111-1111-1111-1111-111111111111}","Name":"Ana Trujillo","Phone":"(5) 555-4729","Address":"c6be7eec-6a39-48c1-b2c5-5b2c1edbff51","Remarks":"Set on server at 26.10.2017 14:03:37","Discount":0}

As you can see the body represents full object to be inserted.

Note: There is no way to report back new ID if AutoInc fields are used. Actually there is no way to send back any server-calculated field values.

Note: There is no way to perform several data update operations in one transaction.


Updating a row

PUT  http://localhost:8099/rest/Customers/{11111111-1111-1111-1111-111111111111}

with a body like

{"Id":"{11111111-1111-1111-1111-111111111111}","Name":"Updated Value","Phone":"(5) 555-4729","Address":"c6be7eec-6a39-48c1-b2c5-5b2c1edbff51","Remarks":"Set on server at 26.10.2017 14:03:37","Discount":0}

Deleting a row:

DELETE http://localhost:8099/rest/Customers/{11111111-1111-1111-1111-111111111111}

As you can see the REST dispatcher provides a simple way to access the data, however it is limited in some areas. For more advanced scerarios like inserting a master-detail object in one batch you’ll need to write separate service methods.

Regards