TeamForge Orchestrate Commits API

Submission parameters

Submission queue
  • queue_name: orchestrate.commits
  • auto_delete: false
  • durable: true
Top-level
Parameter Required/Optional Description
api_version Required A string that matches the API version this document is for.
source_association_key Required A key generated by TeamForge Orchestrate that links incoming commit messages with the appropriate source server.
Example: "source_association_key": "31e8dd90-164f-0130-c4d0-406c8f04c05d"
commit_data Required The commit.
Objects
commit_data - The following fields should be in this commit post.
Field Required/Optional Description
repo_id Optional A unique identifier for this repository. For example, the repo UUID.
revision_id Required A unique identifier for the commit action (eg., revision number or commit id).
branch_name Optional Identifier for the applicable repository branch.
type Required A string representing the activity type.

Accepted values

post-commit - A commit has been completed.

message Optional The message associated with this activity.
changes Optional An array of changed items. Required information about affected paths (an array of hashes).

Accepted values

  • path (Required) - A string with the relative path to the file that created, modified, etc.
  • action (Required) - A string representing the action.
    • added - Added
    • deleted - Deleted
    • modified - Modified
    • props_modified - File properties (not contents) modified
    • type_changed - Type changed (e.g., from 'file' to 'symlink', 'symlink' to 'directory', etc.)
    • copied - Path is copied from another source
    • renamed - Path is renamed from another source
  • from (Optional) - If the activity is a copy or rename, the path from which it was copied or renamed (if it can be determined or inferred with some accuracy; this is not guaranteed to be absolutely correct)
event_time Required A string containing a timestamp in UTC timezone and RFC 3339 format.
created_by Required The user name of the person who took the action.

Examples

The following code examples are Copyright 2020 CollabNet, Inc., licensed under the Apache License, Version 2.0 (the "License"); you may not use this code except in compliance with the License. You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0]

Sample Submission JSON
{
      "api_version": "1",
      "source_association_key" : "150e8951-19e1-4066-8b74-601026dd6cde",
      "commit_data" : {
        "repo_id": "390e8951-19e1-4066-8b74-601026dd6cde",
        "revision_id": "2315",
        "branch_name": "master",
        "type": "post_commit",
        "message": "here's my commit [orc-277]",
        "changes": [
          { "path": "/source/file/1", "action": "modified" },
          { "path": "/source/file/2", "action": "added" },
          { "path": "/source/file/3", "action": "deleted" },
          { "path": "/source/file/4", "action": "modified" },
          { "path": "/source/file/4", "action": "props_modified" }
        ],
        "event_time": "2012-10-02T17:15:32.320Z",
        "created_by": "username"
      }
    }
Ruby Submission Example
You will need to change the following example before you can run it. Set the Rabbit MQ hostname and the association key, and paste a JSON block following the commit format specified on this page.
require 'amqp'

      QUEUE = 'orchestrate.commits'
      COMMIT = '{
        "api_version": "1",
        "source_association_key" : "150e8951-19e1-4066-8b74-601026dd6cde",
        "commit_data" : {
          "repo_id": "390e8951-19e1-4066-8b74-601026dd6cde",
          "revision_id": "2315",
          "branch_name": "master",
          "type": "post_commit",
          "message": "here\'s my commit [orc-277]",
          "changes": [
            { "path": "/source/file/1", "action": "modified" },
            { "path": "/source/file/2", "action": "added" },
            { "path": "/source/file/3", "action": "deleted" },
            { "path": "/source/file/4", "action": "modified" },
            { "path": "/source/file/4", "action": "props_modified" }
          ],
          "event_time": "2012-10-02T17:15:32.320Z",
          "created_by": "username"
        }
      }'

      # Event loop
      EventMachine.run do
        connection = AMQP.connect('amqp://guest:guest@example-mq')

        # Set up our RabbitMQ information
        channel = AMQP::Channel.new(connection)
        queue = channel.queue(QUEUE, :auto_delete => false, durable: true)
        exchange = channel.direct('')

        # Publish the activity and exit the loop
        exchange.publish COMMIT, :routing_key => queue.name do
          connection.disconnect {EventMachine.stop}
        end
      end