Hello,
I ask for advice (question is at the end).
I have a table "TABLE" like this
TABLE
{
id int primary key,
revisionNo int,
[other useful data for my application]
}
I have "TABLE" on one computer "MASTER".
I have "TABLE" on one computer "SLAVE".
The DB is SQLITE so I cannot do queries from on computer to the other (otherwise
there would be no problem in doing what I need).
"TABLE" on "MASTER" is subject to
1. Creation of new records (when a record is created revisionNo is set to 1)
2. Modification of existing record (when a record is modificed revisionNo is increased by 1)
"TABLE" on "SLAVE" must be periodcally aligned in order to be equal to "MASTER" (no
autonomous modifications on "SLAVE", only synchronization)
My idea was to do this using a WEBSERVICE like this (port 8100):
there is a GET method:
http://MASTER:8100/get_table_deltaThe caller of this webservice should provide the following info in the
GET REQUEST BODY (I represent as a json even if my representation would be
different, in the following example I assume the "SLAVE" "TABLE" has following contents)
"SLAVE" "TABLE" contents
id, revisionNo
1, 1
2, 2
3, 1
[1M more records]
JSON sent by "SLAVE"
{
"records" = [
{
"id": "1",
"revisionNo": "1"
},
{
"id": "2",
"revisionNo": "2"
},
{
"id": "3",
"revisionNo": "2"
},
<1M more json objects>
]
}
when the webservice running on "MASTER" receives this json in GET BODY it checks in his "TABLE"
and finds that
"MASTER" "TABLE" contents
id, revisionNo
1, 2
2, 2
3, 1
[1M more records]
1000001, 1
with respect to the one in the "SLAVE"
- item 1 was modified
- item 1000001 was added
therefore, "MASTER" prepares a json (for example) like this
JSON sent back by "MASTER"
{
"delta" = [
{
"id": "1",
"revisionNo": "2",
<all other data of record 1>
},
<1M more json objects>,
{
"id": "1000001",
"revisionNo": "1"
<all other data of record 1000001>
}
]
}
Therefore sending only the things updated or new (here one could say that for item 1
we could send only what has actually changed, but in this case I want to make the
things simple and I resend everything).
And finally the question:
Is it ok and supported that I do a HTTP GET operation sending also a REQUEST BODY?
Is it possible to receive such a REQUEST BODY, parse it and use it as I described?
I read many things telling me that GET should be used only to get objects identified
only using the URI, and including the REQUEST BODY it against this recommendation.
So far I have been using fphttpapp on server side, and fphttpclient on client side...
If is not possible or recommended does anyone have some alternative advice?
THANK YOU!!!