Skip to content

API Documentation

Miro Kubicek edited this page Oct 4, 2018 · 36 revisions

Rest API Documentation

Repository API
Get all job definitions
List head revisions' numbers
List all revisions
Get a job definition
Get specific revision of a job definition
Create/update job definition

Repository API

Get all job definitions

Get latest revision of all job definitions in the repository.

Request

Request method Content type Syntax
GET application/transit+json
application/transit+msgpack
/repo/jobdefinitions

Response

Returns a map of all job definitions that exist in the repository. For each job definition, only the latest (head) revision is returned.

Example Response - Decoded Transit

{"test" {:first-step "step1",
                :name "test",
                :type nil,
                :properties {:name "World"},
                :steps [{:id "step1",
                         :type :custom,
                         :supertype :tasklet,
                         :next [[false "step2"] [true "step3"]],
                         :workload-fn #titanoboa.exp.Expression{:value "(fn [p] 
                                                                        {:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
                                                                :type nil},
                         :properties {}}
                        {:id "step2",
                         :type :custom,
                         :supertype :tasklet,
                         :workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
                                                                :type nil},
                         :next [],
                         :properties {}}
                        {:id "step3",
                         :type :custom,
                         :supertype :tasklet,
                         :workload-fn #titanoboa.exp.Expression{:value "(fn [p]
                                                                        {:message (str (:message p) \"nobody!\")})",
                                                                :type nil},
                         :next [],
                         :properties {}}],
                :revision 2}}

List head revisions' numbers

Request

Request method Content type Syntax
GET application/transit+json
application/transit+msgpack
/repo/jobdefinitions/heads

Response

Returns a map of the latest revision number of each job definition that exists in the repository.

Example Response - Decoded Transit

{"test" 2}

List all revisions

Request

Request method Content type Syntax
GET application/transit+json
application/transit+msgpack
repo/jobdefinitions/revisions

Response

Returns a map of job definitions. For each job definition name as key, the map contains their respective list of revisions which in turn consists of a vector of revision number, its timestamp, author and revision notes.

Example Response - Decoded Transit

{"test" ([2 #inst"2018-10-03T10:28:27.000-00:00" "miro" "dolor sit amet, consectetur adipiscing elit"]
         [1 #inst"2018-10-03T10:28:26.000-00:00" "anonymous" "lorem ipsum"])}

Get a job definition

Request

Request method Content type Syntax
GET application/transit+json
application/transit+msgpack
/repo/jobdefinitions/{job definition's name}

Response

Returns a head revision of given job definitions.

Example Response - Decoded Transit

{:first-step "step1",
        :name "test",
        :type nil,
        :properties {:name "World"},
        :steps [{:id "step1",
                 :type :custom,
                 :supertype :tasklet,
                 :next [[false "step2"] [true "step3"]],
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p] 
                                                                {:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
                                                        :type nil},
                 :properties {}}
                {:id "step2",
                 :type :custom,
                 :supertype :tasklet,
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
                                                        :type nil},
                 :next [],
                 :properties {}}
                {:id "step3",
                 :type :custom,
                 :supertype :tasklet,
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"nobody!\")})",
                                                        :type nil},
                 :next [],
                 :properties {}}],
        :revision 2}

Get specific revision of a job definition

Request

Request method Content type Syntax
GET application/transit+json
application/transit+msgpack
/repo/jobdefinitions/{job definition's name}/{revision}

Response

Returns the specified revision of given job definitions.

Example Response - Decoded Transit

{:first-step "step1",
        :name "test",
        :type nil,
        :properties {:name "World"},
        :steps [{:id "step1",
                 :type :custom,
                 :supertype :tasklet,
                 :next [[false "step2"] [true "step3"]],
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p] 
                                                                {:message (str \"Hello \" (:name p)) :return-code (nil? (:name p))})",
                                                        :type nil},
                 :properties {}}
                {:id "step2",
                 :type :custom,
                 :supertype :tasklet,
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"!\")})",
                                                        :type nil},
                 :next [],
                 :properties {}}
                {:id "step3",
                 :type :custom,
                 :supertype :tasklet,
                 :workload-fn #titanoboa.exp.Expression{:value "(fn [p]\n{:message (str (:message p) \"nobody!\")})",
                                                        :type nil},
                 :next [],
                 :properties {}}],
        :revision 1}

Create/update job definition

Adds a new revision of a job definition. If the job definition does not exists yet, it will be created.

Request

Request method Content type Syntax
POST application/transit+json
application/transit+msgpack
/repo/jobdefinitions/{job definition's name}

Request Attributes

Request Attribute Type Use
:definition map job definition map
:notes String revision notes

Response

Returns number of new revision that was created.

Example Response - Decoded Transit

3