For Restful API, we should use HTTP method for standard actions [1] like
create, retrieve, update, delete.

Only create custom verbs when there are multiple ways to update.


[1] http://restful-api-design.readthedocs.org/en/latest/methods.html


On Wed, Nov 25, 2015 at 9:43 AM, Shi, Shaofeng <[email protected]> wrote:

> For as-is APIs we can keep it; for new APIs, we can try to make it follow
> the REST way as much as possible.
>
> On 11/24/15, 6:35 PM, "Jian Zhong" <[email protected]> wrote:
>
> >Thank you shaofeng,
> >
> >as there are many verb used in  REST in our old design like cube
> >rebuild,disable,enable,refresh.....etc
> >
> >wondering if it's necessary for a refactor.
> >
> >
> https://github.com/apache/incubator-kylin/blob/master/webapp/app/js/servic
> >es/cubes.js
> >
> >
> >On Tue, Nov 24, 2015 at 3:59 PM, Shi, Shaofeng <[email protected]> wrote:
> >
> >> this is good: +1
> >>
> >> On 11/24/15, 3:57 PM, "Luke Han" <[email protected]> wrote:
> >>
> >> >how about /api/cube/{cubeName} ?
> >> >
> >> >
> >> >Best Regards!
> >> >---------------------
> >> >
> >> >Luke Han
> >> >
> >> >On Tue, Nov 24, 2015 at 3:54 PM, Shi, Shaofeng <[email protected]>
> >>wrote:
> >> >
> >> >> hi Jason,
> >> >>
> >> >> with REST’s rule, everything is a resource, “get_cube” is a verb
> >>instead
> >> >> of noun, so I’m afraid it is not good for using in REST API.
> >> >>
> >> >> The “/api/cubes” is good, if fuzzy match by name is not very strong,
> >>you
> >> >> can change its default behavior to exact match, and then add another
> >> >> parameter like “fuzzyMatch=true” to allow user doing fuzzy match.
> >> >>
> >> >> On 11/24/15, 3:02 PM, "Jian Zhong" <[email protected]> wrote:
> >> >>
> >> >> >resolved,
> >> >> >
> >> >> >
> >> >>
> >> >>
> >>
> >>
> https://github.com/apache/incubator-kylin/commit/f3214dd8b5a3b56014584c26
> >> >>0
> >> >> >673f77a67ddc64e
> >> >> >
> >> >> >available API should be
> >> >> >
> >> >> >http://[ip]:[port]/kylin/api/cubes/get_cube?cubeName=[cubeName]
> >> >> >
> >> >> >
> >> >> >On Tue, Nov 24, 2015 at 10:01 AM, ShaoFeng Shi
> >><[email protected]
> >> >
> >> >> >wrote:
> >> >> >
> >> >> >> Create an JIRA to track this:
> >> >> >> https://issues.apache.org/jira/browse/KYLIN-1161
> >> >> >>
> >> >> >> 2015-11-23 18:09 GMT+08:00 Li Yang <[email protected]>:
> >> >> >>
> >> >> >> > We can open a JIRA to add such API if it's not there.
> >> >> >> >
> >> >> >> > On Mon, Nov 23, 2015 at 2:51 PM, yu feng <[email protected]>
> >> >> wrote:
> >> >> >> >
> >> >> >> > > inside kylin code , cubeName is the name you input and do this
> >> >> >> judgement
> >> >> >> > to
> >> >> >> > > decide cubes to return...
> >> >> >> > >
> >> >> >> > > for (CubeInstance cubeInstance : cubeInstances) {
> >> >> >> > >             boolean isCubeMatch = (null == cubeName) ||
> >> >> >> > >
> >> >>
> >>>>cubeInstance.getName().toLowerCase().contains(cubeName.toLowerCase());
> >> >> >> > >
> >> >> >> > >             if (isCubeMatch) {
> >> >> >> > >                 filterCubes.add(cubeInstance);
> >> >> >> > >             }
> >> >> >> > >         }
> >> >> >> > >
> >> >> >> > > so, this is why cube 'v5' and 'v5_21' return ..
> >> >> >> > >
> >> >> >> > > 2015-11-23 14:23 GMT+08:00 杨海乐 <[email protected]>:
> >> >> >> > >
> >> >> >> > > >          When I use restful api to get details of a cube, I
> >> >>found
> >> >> >> that
> >> >> >> > > the
> >> >> >> > > > server will return more than one cube’s detail I want. For
> >> >> >>example:
> >> >> >> > > > I use the url:
> >> >> >> > > >
> >> >>
> >>>>http://server_ip:7070/kylin/api/cubes?cubeName=v5&limit=15&offset=0.
> >> >> >> > The
> >> >> >> > > > server will return these:
> >> >> >> > > >    [
> >> >> >> > > >     {
> >> >> >> > > >         "uuid": "876dd9d8-bc40-45fd-be6b-e0429ff9d4d1",
> >> >> >> > > >         "name": "v5",
> >> >> >> > > >         "owner": "ADMIN",
> >> >> >> > > >         "version": null,
> >> >> >> > > >         "cost": 50,
> >> >> >> > > >         "status": "READY",
> >> >> >> > > >         "segments": [
> >> >> >> > > >             {
> >> >> >> > > >                 "uuid":
> >>"dd80cab3-1069-4333-8463-e0e48f2602c6",
> >> >> >> > > >                 "name": "20151020000000_20151021000000",
> >> >> >> > > >                 "status": "READY",
> >> >> >> > > >                                      ……….
> >> >> >> > > >             },
> >> >> >> > > >             {
> >> >> >> > > >                 "uuid":
> >>"960e44b8-ac38-4483-8dbe-6a6a817ff4e1",
> >> >> >> > > >                 "name": "20151020000000_20151022000000",
> >> >> >> > > >                 "status": "NEW",
> >> >> >> > > > ……….
> >> >> >> > > >             },
> >> >> >> > > >             {
> >> >> >> > > >                 "uuid":
> >>"a8f6116f-acd6-46ac-be2f-021c2b291531",
> >> >> >> > > >                 "name": "20151021000000_20151022000000",
> >> >> >> > > >                 "status": "READY",
> >> >> >> > > >                                      ……….
> >> >> >> > > >
> >> >> >> > > >             }
> >> >> >> > > >         ],
> >> >> >> > > >         "last_modified": 1448258568340,
> >> >> >> > > >         "descriptor": "v5",
> >> >> >> > > >         "create_time_utc": 1448244454401,
> >> >> >> > > >         "auto_merge_time_ranges": null,
> >> >> >> > > >         "retention_range": 0,
> >> >> >> > > >         "size_kb": 0,
> >> >> >> > > >         "input_records_count": 0,
> >> >> >> > > >         "input_records_size": 0
> >> >> >> > > >     },
> >> >> >> > > >     {
> >> >> >> > > >         "uuid": "c0dc404a-cfe6-4315-ac1c-ef52b27f8335",
> >> >> >> > > >         "name": "v5_21",
> >> >> >> > > >         "owner": "ADMIN",
> >> >> >> > > >         "version": null,
> >> >> >> > > >         "cost": 50,
> >> >> >> > > >         "status": "READY",
> >> >> >> > > >         "segments": [
> >> >> >> > > >             {
> >> >> >> > > >                 "uuid":
> >>"c8e195ba-51a9-4fd9-be86-40e9943bcb1c",
> >> >> >> > > >                 "name": "20151021000000_20151022000000",
> >> >> >> > > >                "status": "READY",
> >> >> >> > > >                                      ……….
> >> >> >> > > >             }
> >> >> >> > > >         ],
> >> >> >> > > >         "last_modified": 1448257690944,
> >> >> >> > > >         "descriptor": "v5_21",
> >> >> >> > > >         "create_time_utc": 1448247295576,
> >> >> >> > > >         "auto_merge_time_ranges": null,
> >> >> >> > > >         "retention_range": 0,
> >> >> >> > > >         "size_kb": 0,
> >> >> >> > > >         "input_records_count": 0,
> >> >> >> > > >         "input_records_size": 0
> >> >> >> > > >     }
> >> >> >> > > > ]
> >> >> >> > > > I don’t understand why this happen. The v5_21 cube and v5
> >>cube
> >> >> >>base a
> >> >> >> > > > sample fact table and project.
> >> >> >> > > >
> >> >> >> > >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Best regards,
> >> >> >>
> >> >> >> Shaofeng Shi
> >> >> >>
> >> >>
> >> >>
> >>
> >>
>
>

Reply via email to