Build Cube with API
1. Authentication
- Currently, Kylin uses basic authentication.
- Add
Authorization
header to first request for authentication - Or you can do a specific request by
POST http://localhost:7070/kylin/api/user/authentication
- Once authenticated, client can go subsequent requests with cookies.
POST http://localhost:7070/kylin/api/user/authentication
Authorization:Basic xxxxJD124xxxGFxxxSDF
Content-Type: application/json;charset=UTF-8
2. Get details of cube.
GET http://localhost:7070/kylin/api/cubes?cubeName={cube_name}&limit=15&offset=0
- Client can find cube segment date ranges in returned cube detail.
GET http://localhost:7070/kylin/api/cubes?cubeName=test_kylin_cube_with_slr&limit=15&offset=0
Authorization:Basic xxxxJD124xxxGFxxxSDF
Content-Type: application/json;charset=UTF-8
3. Then submit a build job of the cube.
PUT http://localhost:7070/kylin/api/cubes/{cube_name}/rebuild
- For put request body detail please refer to Build Cube API.
startTime
andendTime
should be utc timestamp.buildType
can beBUILD
,MERGE
orREFRESH
.BUILD
is for building a new segment,REFRESH
for refreshing an existing segment.MERGE
is for merging multiple existing segments into one bigger segment.
- This method will return a new created job instance, whose uuid is the unique id of job to track job status.
PUT http://localhost:7070/kylin/api/cubes/test_kylin_cube_with_slr/rebuild
Authorization:Basic xxxxJD124xxxGFxxxSDF
Content-Type: application/json;charset=UTF-8
{
"startTime": 0,
"endTime": 1388563200000,
"buildType": "BUILD"
}
4. Track job status.
GET http://localhost:7070/kylin/api/jobs/{job_uuid}
- Returned
job_status
represents current status of job.
5. If the job got errors, you can resume it.
PUT http://localhost:7070/kylin/api/jobs/{job_uuid}/resume
6. Adjust the cuboid list of a cube and trigger optimize segment job
PUT http://localhost:7070/kylin/api/cubes/{cube_name}/optimize2