layout: docs title: Build Cube with API categories: howto permalink: /docs/howto/howto_build_cube_with_restapi.html

1. Authentication

Authorization:Basic xxxxJD124xxxGFxxxSDF Content-Type: application/json;charset=UTF-8 {% endhighlight %}

2. Get details of cube.

Authorization:Basic xxxxJD124xxxGFxxxSDF Content-Type: application/json;charset=UTF-8 {% endhighlight %}

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 and endTime should be utc timestamp.
    • buildType can be BUILD ,MERGE or REFRESH. 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. {% highlight Groff markup %} 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” } {% endhighlight %}

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