time-entries

Get the current timer

GET /v1/time-entries/current

Return the current running time entry, or item=null when no timer is running.

Request example

Replace path and request parameters with actual values. For requests with a body, save it as request.json using the schema above.

curl --fail-with-body --request GET 'https://api.treering.cn/v1/time-entries/current' \
  --header "Authorization: Bearer $TREERING_API_TOKEN"

Responses

200

Successful response; status depends on the operation result.

application/json

Type: object

FieldTypeRequiredDescription and constraints
itemobject | nullYesSingle resource, or null
item (anyOf 1)objectNo{"additionalProperties":false}
item (anyOf 1).idstringYesResource, job or operation identifier
item (anyOf 1).versionstringYesVersion as a decimal string; do not convert to a floating-point number {"pattern":"^(0|[1-9][0-9]*)$"}
item (anyOf 1).etagstringYesConcurrency tag; preserve quotes when sending If-Match
item (anyOf 1).updatedAtstringYesLast server update timestamp
item (anyOf 1).operationIdstringNoRequest receipt identifier; no status polling is needed
item (anyOf 1).deletedAtstringNoDeletion timestamp
item (anyOf 1).startTimestring | nullNoStart timestamp in ISO 8601 with a time zone
item (anyOf 1).startTime (anyOf 1)stringNo
item (anyOf 1).startTime (anyOf 2)nullNo
item (anyOf 1).stopTimestring | nullNoStop timestamp; null means running
item (anyOf 1).stopTime (anyOf 1)stringNo
item (anyOf 1).stopTime (anyOf 2)nullNo
item (anyOf 1).detailstring | nullNoEntry description
item (anyOf 1).detail (anyOf 1)stringNo
item (anyOf 1).detail (anyOf 2)nullNo
item (anyOf 1).notestring | nullNoNote
item (anyOf 1).note (anyOf 1)stringNo
item (anyOf 1).note (anyOf 2)nullNo
item (anyOf 1).projectIdstring | nullNoProject ID, or null
item (anyOf 1).projectId (anyOf 1)stringNo
item (anyOf 1).projectId (anyOf 2)nullNo
item (anyOf 1).tagIdsarray<string>NoTag IDs; comma-separated GET filter, array in bodies
item (anyOf 1).tagIds[]stringNo
item (anyOf 1).sourcestring | nullNoSource label
item (anyOf 1).source (anyOf 1)stringNo
item (anyOf 1).source (anyOf 2)nullNo
item (anyOf 1).statestringNoEntry, job or operation state; meaning depends on the endpoint
item (anyOf 1).durationSecondsnumber | nullNoDuration in seconds; may be fractional
item (anyOf 1).durationSeconds (anyOf 1)numberNo
item (anyOf 1).durationSeconds (anyOf 2)nullNo
item (anyOf 2)nullNo
metaobjectYesEvaluation metadata
meta.evaluatedAtstringYesServer evaluation timestamp
meta.elapsedSecondsnumber | nullYesElapsed seconds at evaluation time
meta.elapsedSeconds (anyOf 1)numberNo
meta.elapsedSeconds (anyOf 2)nullNo
Complete JSON Schema
{
  "type": "object",
  "required": [
    "item",
    "meta"
  ],
  "properties": {
    "item": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "id",
            "version",
            "etag",
            "updatedAt"
          ],
          "properties": {
            "id": {
              "type": "string",
              "description": "Resource, job or operation identifier"
            },
            "version": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Version as a decimal string; do not convert to a floating-point number"
            },
            "etag": {
              "type": "string",
              "description": "Concurrency tag; preserve quotes when sending If-Match"
            },
            "updatedAt": {
              "type": "string",
              "description": "Last server update timestamp"
            },
            "operationId": {
              "type": "string",
              "description": "Request receipt identifier; no status polling is needed"
            },
            "deletedAt": {
              "type": "string",
              "description": "Deletion timestamp"
            },
            "startTime": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Start timestamp in ISO 8601 with a time zone"
            },
            "stopTime": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Stop timestamp; null means running"
            },
            "detail": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Entry description"
            },
            "note": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Note"
            },
            "projectId": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Project ID, or null"
            },
            "tagIds": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Tag IDs; comma-separated GET filter, array in bodies"
            },
            "source": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Source label"
            },
            "state": {
              "type": "string",
              "description": "Entry, job or operation state; meaning depends on the endpoint"
            },
            "durationSeconds": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Duration in seconds; may be fractional"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Single resource, or null"
    },
    "meta": {
      "type": "object",
      "required": [
        "evaluatedAt",
        "elapsedSeconds"
      ],
      "properties": {
        "evaluatedAt": {
          "type": "string",
          "description": "Server evaluation timestamp"
        },
        "elapsedSeconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Elapsed seconds at evaluation time"
        }
      },
      "description": "Evaluation metadata"
    }
  }
}

400, 401, 403, 404, 429, 500, 503

Error response; branch on code.

application/json

Type: object

FieldTypeRequiredDescription and constraints
codestringYesMachine-readable error code
messagestringNoError message; use code for program logic
requestIdstringNoRequest trace identifier
operationIdstringNoRequest receipt identifier; no status polling is needed
Complete JSON Schema
{
  "type": "object",
  "required": [
    "code"
  ],
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Error message; use code for program logic"
    },
    "requestId": {
      "type": "string",
      "description": "Request trace identifier"
    },
    "operationId": {
      "type": "string",
      "description": "Request receipt identifier; no status polling is needed"
    }
  },
  "additionalProperties": true
}

On this page