Wednesday, 14 August 2013

How to construct a REST API take Json payload as the input?

How to construct a REST API take Json payload as the input?

I have a HTTP REST api wanting to wrap a underlying datasource(can be
RDBMS like mysql or something else, like HBase). I want to construct an
REST API and wrap the underlying implementation, so my API might look
like:
http://${APIServer}/${TableName}?attrs=A,B,C&${json_payload}
The payload looks like:
{
"like": {
"name": "kev"
},
"equal": {
"id": "2",
"sex": "male"
}
}
To achieve something like:
select A,B,C from TableName where name=shengjie and address like %Ireland%
I want to wrap the WHERE conditions into the json_paylaod, is there any
best practice for this?

No comments:

Post a Comment