JSON API: /artifact

(⬑JSON API Index)

Jump to:

Checkin Artifacts (Commits)

Returns information about checkin artifacts (commits).

Status: implemented 201110xx

Request: /json/artifact/COMMIT_HASH

Required permissions: "o" (was "h" prior to 20120408)

Response payload example: (CHANGED SIGNIFICANTLY ON 20120713)

"name":"18dd383e5e7684e", // as given on CLI
"comment":"Merge wideAnnotateUser and jsonWarnings into trunk.",
  // 1st entry is primary parent hash:
  // Remaining entries are merged-in branch hashes:
    // BLOB hashes, NOT commit hashes:

The "parents" property lists the parent hashes of the checkin. The "parent" property of file entries refers to the parent hash of that file. In the case of a merge there may be essentially an arbitrary number. The first entry in the list is the "primary" parent. The primary parent is the parent which was not pulled in via a merge operation. The ordering of remaining entries is unspecified and may even change between calls. For example: if, from branch C, we merge in A and B and then commit, then in the artifact response for that commit the hash of branch C will be in the first (primary) position, with the hashes for branches A and B in the following entries (in an unspecified, and possibly unstable, order).

Note that the "uuid" and "parent" properties of the "files" entries refer to raw blob hashes, not commit (a.k.a. check-in) hashes. See also the UUID vs. Hash discussion.

File Artifacts

Fetches information about file artifacts.

FIXME: the content type guessing is currently very primitive, and may (but i haven't seen this) mis-diagnose some non-binary files as binary. Fossil doesn't yet have a mechanism for mime-type mappings.

Status: implemented 20111020

Required permissions: "o"

Request: /json/artifact/FILE_HASH

Request options:

Response payload example: (CHANGED SIGNIFICANTLY ON 20120713)

"name":"same name specified as FILE_HASH argument",
"size": 12345, // in bytes, independent of format=...
"parent": "hash of parent file blob. Not set for first generation.",
/* The following "content" properties are only set if format=raw|html */
"content": "file contents",
"contentSize": "size of content field, in bytes. Affected by the format option!",
"contentType": "text/plain", /* currently always text/plain */
"contentFormat": "html|raw"

The "checkins" array lists all checkins which include this file, and a file might have different names across different branches. The size and hash, however, are the same across all checkins for a given blob.

Wiki Artifacts

Returns information about wiki artifacts.

Status: implemented 20111020, fixed to return the requested version (instead of the latest) on 20120302.

Request: /json/artifact/WIKI_HASH

Required permissions: "j"


Response payload example:

Currently the same as /json/wiki/get.