You are not logged in.
Pages: 1
I am working on a webclient with SAPUI5.
SAPUI5 can work very nice with a REST server (as mORMot).
At the moment, the mORMot responds with a list of ID's when a table is requested through REST.
E.g.
http://localhost:8080/root/SampleRecord
gives as result:
[{"ID":1},{"ID":2},{"ID":3},{"ID":4}]
In some cases, SAPUI5 wants more from a root request (for fast master/detail apps).
So, would it be possible to add some custom fields (e.g. FirstName, LastName) into the root request.
At the moment, the mORMot does
SQLSelect := 'RowID'; // if no select is specified (i.e. ModelRoot/TableName)
Or should I make my own changes into TSQLRestServerURIContext.ExecuteORMGet ?
I also tried to make an overloaded version of the root request with a dedicated method, but failed.
Offline
try this:
http://localhost:8080/root/SampleRecord/?select=FirstName,LastName
Esteban
Offline
Thanks !
This works as expected !!
I will use this.
However, some tuning of the bare root response would remain welcome (field-list, '', '*').
Offline
I don't understand you.
?select=field1,field2,fieldN => field list
?select= or select='' => list all fields except blobs
?select=* => list all fields including blobs
is not it enough four you ?
Esteban
Offline
Tried all, and all work as expected.
So, for me, everything is ok !
It is just that I wanted to be able to get a custom reply when asking for a plain (table) root.
AFAIK, there is no real standard reply on a plain root request.
And, at the moment, I am not able to change the default behavior of mORMot: reply with ID's.
My goal: have a web-front-end that can work with many types of REST-servers.
Many other REST-servers do give more than just ID's when asking for root.
But again, I am happy with the solution you provided !
Offline
Another question, related to this one.
The mORMot response for a root request without any table of whatever, is a nice
{
"errorCode":400,
"errorText":"Bad Request"
}
When using OData services, the root request gives a table overview.
E.g.
http://services.odata.org/V3/OData/OData.svc/
gives a nice overview of the available tables in the model
I also found an old thread about OData: http://synopse.info/forum/viewtopic.php?pid=2621#p2621
Would it be an idea (or feature request) to add some more info into the bare root request: a JSON / XML overview of the model ?
Would be usefull for me ...
Offline
Pages: 1