TeamForge EventQ Review Requests API

Submission parameters

Submission queue
  • queue_name: eventq.reviews
  • 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 EventQ that links incoming review requests with the appropriate source server.
Example: "source_association_key": "31e8dd90-164f-0130-c4d0-406c8f04c05d"
request_data Required The raw review request data, as provided by the review server.
Objects
request_data - The following fields should be in this review request object.
Field Required/Optional Description
remote_id Required A string to uniquely identify the review request.
link Optional A URL that points back to this individual review.
summary Optional A string to summarize the review request.
description Optional A longer string that can be used to further describe the review request. It will appear in the UI.
created_by Required A string containing the username of the person who submitted the request (e.g., initiated this request event, NOT necessarily the creator of the review; in some instances, this may consistently be an administrative user).
status Required An object that declares the status of the review request.

Accepted values

  • type (Required) - A string representing the type of the status.
    • open - The review request is currently open for review.
    • submitted - The review request changes have been submitted.
    • rejected - The code in the request was rejected.
    • discarded - The review request has been discarded.
    • other - A status type that may not fit into the above list.
  • name (Required) - A user-friendly display name for the status.
event_time Required A string containing a timestamp in UTC timezone and RFC 3339 format.
updated_by Optional A string containing the username of the person performing the update.
files Optional An array of objects with optional SCM revision information. If included, only the file name is required.

Accepted values

  • file (Required) - A string with the full path to the file that was being reviewed.
  • revision (Optional) - A string representing the revision number of the commit that includes this file.
  • repository_url (Optional - A string with the URL to the SCM server. For associations to commits, this must match one defined as a source in the same pipeline.
reviewers Optional A array of user hashes. Optional reviewer information. If included, only the user name is required. For some systems (e.g., Crucible), reviewers are only reported when they have marked the review 'completed' or 'reviewed'; other systems (e.g., Review Board) report reviewers when they add comments or make other changes to a review.

Accepted values

  • username (Required) - A string of the user's name.
  • link (Optional) - A string representing the URL to the users profile.

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" : "31e8dd90-164f-0130-c4d0-406c8f04c05d",
    "request_data" : {
      "remote_id": "42",
      "link": "http://reviewserver/review/42/",
      "summary": "The summary of the request",
      "description": "An extended description of what the request covers",
      "status": {
        "type": "open",
        "name": "Review"
      },
      "event_time": "2012-10-02T17:15:32.320Z",
      "created_by": "username",
      "updated_by": "username",
      "files": [
        {
          "revision": "ef9f8fe661992f48c3539c05fc5c69c61918fa17",
          "file": "commit1_file1.txt",
          "repository_url": "ssh://gitserver/project"
        },
        {
          "revision": "ef9f8fe661992f48c3539c05fc5c69c61918fa17",
          "file": "commit1_file2.txt",
          "repository_url": "ssh://gitserver/project"
        },
        {
          "revision": "fb849a2440dda438f4c6ab25f8c3266ed82d8797",
          "file": "commit2_file1.txt",
          "repository_url": "ssh://othergitserver/project"
        }
      ],
      "reviewers": [
        { "username": "adent", "link": "http://reviewserver/user/adent" },
        { "username": "fprefect", "link": "http://reviewserver/user/fprefect" }
      ]
    }
}
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 review format specified on this page.
require 'amqp'

    QUEUE = 'eventq.reviews'
    REVIEW = '{
      "api_version": "1",
      "source_association_key" : "31e8dd90-164f-0130-c4d0-406c8f04c05d",
      "request_data" : {
        "remote_id": "42",
        "link": "http://reviewserver/review/42/",
        "summary": "The summary of the request",
        "description": "An extended description of what the request covers",
        "status": {
          "type": "open",
          "name": "Review"
        },
        "event_time": "2012-10-02T17:15:32.320Z",
        "created_by": "username",
        "files": [
          {
            "revision": "ef9f8fe661992f48c3539c05fc5c69c61918fa17",
            "file": "commit1_file1.txt",
            "repository_url": "ssh://gitserver/project"
          },
          {
            "revision": "ef9f8fe661992f48c3539c05fc5c69c61918fa17",
            "file": "commit1_file2.txt",
            "repository_url": "ssh://gitserver/project"
          },
          {
            "revision": "fb849a2440dda438f4c6ab25f8c3266ed82d8797",
            "file": "commit2_file1.txt",
            "repository_url": "ssh://othergitserver/project"
          }
        ],
        "reviewers": [
          { "username": "adent", "link": "http://reviewserver/user/adent" },
          { "username": "fprefect", "link": "http://reviewserver/user/fprefect" }
        ]
      }
    }'

    # 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 REVIEW, :routing_key => queue.name do
        connection.disconnect {EventMachine.stop}
      end
    end