Logging Work via the API

Due to our privacy-first approach, detailed in this article, you must use the Jira REST API to create work logs. When creating work logs, you can also include JetTime-specific metadata as part of the work log properties. For details on JetTime metadata, refer to JetTime Work Log Metadata article.

To create work logs, refer to the Jira API documentation for creating work logs via POST.

Example JSON Body

{
  "comment": {
    "content": [
      {
        "content": [
          {
            "text": "I did some work here.",
            "type": "text"
          }
        ],
        "type": "paragraph"
      }
    ],
    "type": "doc",
    "version": 1
  },
  "started": "2025-01-02T13:04:16.208+0000",
  "timeSpentSeconds": 3600,
  "properties": [
    {
      "key": "jettime",
      "value": {
        "schemaVersion": 1,
        "author": {
          "accountId": "5c2922bd4b248c315badd7fb",
          "displayName": "Jame Jameson",
          "avatarUrl": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5c2922bd4b248c315badd7fb/28d63995-f039-4214-b057-cdb82f373b33/128"
        },
        "timeSpentSeconds": {
          "BILLABLE": 600
        },
        "fields": {
          "EXPENSE": 240.45,
          "INTERNAL": false,
          "WORK_TYPE": "Consulting"
        },
        "account": {
          "name": "Acme Corp",
          "key": "ACME"
        }
      }
    }
  ]
}

Explanation of Key Fields

  • BILLABLE: This key under timeSpentSeconds represents a custom time category. Custom time category keys, such as BILLABLE, are defined in the JetTime app UI when you create the category, along with its other parameters (e.g., display name and attributes).
  • fields: These keys represent custom work log fields configured in the JetTime app UI. Each key, such as EXPENSE, INTERNAL, or WORK_TYPE, is defined in the UI when the custom work log field is created, alongside its type (e.g., numeric, text, boolean):
    • EXPENSE: Tracks financial expenses in numeric values.
    • INTERNAL: A boolean field indicating whether the work is internal or external.
    • WORK_TYPE: A text field describing the type of work performed (e.g., “Consulting”).
  • account: Represents the client or project account, defined in JetTime’s account management section, with attributes like name and key.
  • author: The author field is included in metadata to allow logging work on behalf of others, as explained in the Managing Work Logs for Others via the API article. It includes three subfields:
    • accountId: The unique identifier of the author in Jira.
    • displayName: The display name of the author.
    • avatarUrl: The URL to the author’s profile avatar.

    If any of the author subfields are missing, JetTime will fall back to using the native Jira work log author instead.

Using this example, you can seamlessly integrate JetTime’s metadata into your Jira work logs while maintaining privacy and flexibility for your time tracking needs.