POST /repos
Request body
repoFullName
(String
of format<owner>/<name>
): The name of the repository
Example:
{
"repoFullName": "fred/hello-world"
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world",
"id": "8rNFhDWE6x42io2Hq"
},
"fullName": "fred/hello-world",
"name": "hello-world",
"owner": "fred",
"ownerId": "g8dB4y3DYSPQfeXkL",
"refs": {
"branches/master": "0000000000000000000000000000000000000000"
}
},
"statusCode": 201
}
GET /repos/:repoOwner/:repoName/db/refs/:refName
Response
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/refs/branches/master",
"refName": "branches/master"
},
"entry": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"type": "commit"
}
},
"statusCode": 200
}
GET /repos/:repoOwner/:repoName/db/refs
Response
Status: 200
{
"data": {
"count": 2,
"items": [
{
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/refs/branches/master",
"refName": "branches/master"
},
"entry": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"type": "commit"
}
},
{
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/refs/branches/foo/bar",
"refName": "branches/foo/bar"
},
"entry": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"type": "commit"
}
}
]
},
"statusCode": 200
}
PATCH /repos/:repoOwner/:repoName/db/refs/:refName
Request body
new
(String
): The new value of the reference (a hex sha1).old
(String
): The old value of the reference (a hex sha1).
The old value must be specified as a safety measure against accidentally
overwriting a reference that has been modified by someone else. null
or
0000000000000000000000000000000000000000
can be used to indicate that the
reference is unset.
Example:
{
"new": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"old": "0000000000000000000000000000000000000000"
}
Response
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/refs/branches/master",
"refName": "branches/master"
},
"entry": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"type": "commit"
}
},
"statusCode": 200
}
DELETE /repos/:repoOwner/:repoName/db/refs/:refName
Request body
old
(String
): The old value of the reference (a hex sha1).
The old value must be specified as a safety measure against accidentally deleting a reference that has been modified by someone else.
Example:
{
"old": "7215f2bb2b2128da2abb00b90e2be2f0274016cc"
}
Response
Status: 204
GET /repos/:repoOwner/:repoName/db/commits/:sha1?format=:format
Request query params
format=:format
(minimal
orhrefs
with optional suffix.v0
of.v1
; default:hrefs
): Specifies whether the result contains a minimal representation or embedded hrefs. The suffix specifies which representation version to return. The default without suffix is to return the representation that matches_idversion
.
Response
With hrefs:
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc?format=hrefs
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc"
},
"_idversion": 1,
"authorDate": "2016-02-18T06:14:20+00:00",
"authors": [
"unknown <unknown>"
],
"commitDate": "2016-02-18T06:14:20+00:00",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/6812c564e1b0b4c4abd6d1fa75f467f0e57079d4",
"sha1": "6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
}
],
"subject": "Initial commit",
"tree": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
}
},
"statusCode": 200
}
With hrefs, representation v0 with UTC Z datetimes:
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/86e03b3720b912ff3ae6de494464f8a764597778?format=hrefs.v0
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/86e03b3720b912ff3ae6de494464f8a764597778",
"sha1": "86e03b3720b912ff3ae6de494464f8a764597778"
},
"_idversion": 0,
"authorDate": "2015-01-01T00:00:00Z",
"authors": [
"unknown <unknown>"
],
"commitDate": "2015-01-01T00:00:00Z",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {},
"parents": [],
"subject": "Initial commit",
"tree": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/5af3a99f790fc7cfee9622b35564585c8d4df64a",
"sha1": "5af3a99f790fc7cfee9622b35564585c8d4df64a"
}
},
"statusCode": 200
}
With hrefs, representation v1 with UTC timezone support:
Note that _idversion
and format version may differ. To compute the correct
id, the client code must convert the dates to the correct _idversion
, which
is UTC Z for _idversion: 0
.
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc?format=hrefs.v1
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc"
},
"_idversion": 1,
"authorDate": "2016-02-18T06:14:20+00:00",
"authors": [
"unknown <unknown>"
],
"commitDate": "2016-02-18T06:14:20+00:00",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/6812c564e1b0b4c4abd6d1fa75f467f0e57079d4",
"sha1": "6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
}
],
"subject": "Initial commit",
"tree": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
}
},
"statusCode": 200
}
Minimal:
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc?format=minimal
Status: 200
{
"data": {
"_id": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"_idversion": 1,
"authorDate": "2016-02-18T06:14:20+00:00",
"authors": [
"unknown <unknown>"
],
"commitDate": "2016-02-18T06:14:20+00:00",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
"6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
],
"subject": "Initial commit",
"tree": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
},
"statusCode": 200
}
Minimal, representation v0 with UTC Z datetimes:
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/86e03b3720b912ff3ae6de494464f8a764597778?format=minimal.v0
Status: 200
{
"data": {
"_id": "86e03b3720b912ff3ae6de494464f8a764597778",
"_idversion": 0,
"authorDate": "2015-01-01T00:00:00Z",
"authors": [
"unknown <unknown>"
],
"commitDate": "2015-01-01T00:00:00Z",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {},
"parents": [],
"subject": "Initial commit",
"tree": "5af3a99f790fc7cfee9622b35564585c8d4df64a"
},
"statusCode": 200
}
Minimal, representation v1 with UTC timezone support:
GET http://localhost:3000/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc?format=minimal.v1
Status: 200
{
"data": {
"_id": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"_idversion": 1,
"authorDate": "2016-02-18T06:14:20+00:00",
"authors": [
"unknown <unknown>"
],
"commitDate": "2016-02-18T06:14:20+00:00",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
"6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
],
"subject": "Initial commit",
"tree": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
},
"statusCode": 200
}
POST /repos/:repoOwner/:repoName/db/commits?format=:format
Request query params
format=:format
(minimal
orhrefs
with optional suffix.v0
or.v1
; default:hrefs
): Specifies whether the result is a minimal representation or contains embedded hrefs (see example at get).
Request body
The body contains a JSON representation of the commit with the following keys:
subject
(String
): The subject line of the commit.message
(String
): The body of the commit message.tree
(String
): The id of the tree as a hex sha1.parents
([String]
): The ids of the parent commits as hex sha1s. The array may be empty.authors
([String]
, optional): An array of authors, by conventionJohn Q. Public <[email protected]>
.authorDate
(String
, optional): An ISO string without fractional seconds (see below for_idversion
).committer
(String
, optional)commitDate
(String
, optional): An ISO string without fractional seconds (see below for_idversion
).meta
(Object
, optional): Meta data that is stored with the commit._idversion
(0
or1
, default1
): Specify format to use for computing the sha1 id.
The date format differs between representation versions:
_idversion 0
: Dates are UTC with Z timezone indicator._idversion 1
: Dates use a timezone offset+HH:MM
or-HH:MM
.
Example:
{
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
"6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
],
"subject": "Initial commit",
"tree": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc"
},
"_idversion": 1,
"authorDate": "2016-02-18T06:14:20+00:00",
"authors": [
"unknown <unknown>"
],
"commitDate": "2016-02-18T06:14:20+00:00",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/6812c564e1b0b4c4abd6d1fa75f467f0e57079d4",
"sha1": "6812c564e1b0b4c4abd6d1fa75f467f0e57079d4"
}
],
"subject": "Initial commit",
"tree": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
}
},
"statusCode": 201
}
Commit idversion 0
:
POST /repos/:repoOwner/:repoName/db/commits?format=:format
{
"_idversion": 0,
"authorDate": "2015-01-01T00:00:00Z",
"commitDate": "2015-01-01T00:00:00Z",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"parents": [],
"subject": "Initial commit",
"tree": "5af3a99f790fc7cfee9622b35564585c8d4df64a"
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/commits/86e03b3720b912ff3ae6de494464f8a764597778",
"sha1": "86e03b3720b912ff3ae6de494464f8a764597778"
},
"_idversion": 0,
"authorDate": "2015-01-01T00:00:00Z",
"authors": [
"unknown <unknown>"
],
"commitDate": "2015-01-01T00:00:00Z",
"committer": "unknown <unknown>",
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {},
"parents": [],
"subject": "Initial commit",
"tree": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/5af3a99f790fc7cfee9622b35564585c8d4df64a",
"sha1": "5af3a99f790fc7cfee9622b35564585c8d4df64a"
}
},
"statusCode": 201
}
GET /repos/:repoOwner/:repoName/db/objects/:sha1?format=:format
Request query params
format=:format
(minimal
orhrefs
with optional suffix.v0
or.v1
; default:hrefs
): Specifies whether the result contains a minimal representation or embedded hrefs.
Response
With hrefs:
GET http://localhost:3000/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b?format=hrefs
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b",
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b"
},
"_idversion": 1,
"blob": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/blobs/3f786850e387550fdab836ed7e6dc881de23001b",
"sha1": "3f786850e387550fdab836ed7e6dc881de23001b"
},
"meta": {
"random": "bukxwstgav",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data",
"text": null
},
"statusCode": 200
}
Minimal:
GET http://localhost:3000/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b?format=minimal
Status: 200
{
"data": {
"_id": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"_idversion": 1,
"blob": "3f786850e387550fdab836ed7e6dc881de23001b",
"meta": {
"random": "bukxwstgav",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data",
"text": null
},
"statusCode": 200
}
Minimal, explicit format version 0:
Note that _idversion
and format version may differ. To compute the correct
sha1, the client must convert the format to the _idversion
that the server
reported.
GET http://localhost:3000/api/repos/fred/hello-world/db/objects/5541d329b004502cbed1d97f037dcf20527fd29f?format=minimal.v0
Status: 200
{
"data": {
"_id": "5541d329b004502cbed1d97f037dcf20527fd29f",
"_idversion": 0,
"blob": "0000000000000000000000000000000000000000",
"meta": {
"content": "Lorem ipsum...",
"random": "syskehmxsk"
},
"name": "fake-index.md"
},
"statusCode": 200
}
Minimal, explicit format version 1:
GET http://localhost:3000/api/repos/fred/hello-world/db/objects/5541d329b004502cbed1d97f037dcf20527fd29f?format=minimal.v1
Status: 200
{
"data": {
"_id": "5541d329b004502cbed1d97f037dcf20527fd29f",
"_idversion": 0,
"blob": null,
"meta": {
"random": "syskehmxsk"
},
"name": "fake-index.md",
"text": "Lorem ipsum..."
},
"statusCode": 200
}
POST /repos/:repoOwner/:repoName/db/objects?format=:format
Request query params
format=:format
(minimal
orhrefs
; default:hrefs
): Specifies whether the result is a minimal representation or contains embedded hrefs (see example at get)
Request body
The body contains a JSON representation of the object with the following keys:
blob
(String
ornull
): The identifier of the associated blob (a hex sha1).text
(String
ornull
; since format version 1): Text content of the object. Text content is indexed for fulltext search, while blob content is opaque. By convention either useblob
ortext
, or none of them; but do not use both at the same time.name
(String
): The name of the object.meta
(Object
): Meta data that is stored with the object._idversion
(0
or1
, default1
): Specify the format to use for computing the sha1 id.
There are two different format versions:
_idversion 0
: Absence of a blob is indicated by0000000000000000000000000000000000000000
. Fulltext is, by convention, stored inmeta.content
._idversion 1
: Absence of a blob is indicated bynull
. Fulltext is stored intext
(may benull
).
Example:
{
"blob": "3f786850e387550fdab836ed7e6dc881de23001b",
"meta": {
"random": "elkqaanymh",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data"
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/15635f828b11153643f932b3e57fd9f527a4be66",
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66"
},
"_idversion": 1,
"blob": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/blobs/3f786850e387550fdab836ed7e6dc881de23001b",
"sha1": "3f786850e387550fdab836ed7e6dc881de23001b"
},
"meta": {
"random": "elkqaanymh",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data",
"text": null
},
"statusCode": 201
}
Object with idversion 0 layout:
POST /repos/:repoOwner/:repoName/db/objects?format=:format
{
"_idversion": 0,
"blob": null,
"meta": {
"content": "Lorem ipsum...",
"random": "syskehmxsk"
},
"name": "fake-index.md"
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/5541d329b004502cbed1d97f037dcf20527fd29f",
"sha1": "5541d329b004502cbed1d97f037dcf20527fd29f"
},
"_idversion": 0,
"blob": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/blobs/0000000000000000000000000000000000000000",
"sha1": "0000000000000000000000000000000000000000"
},
"meta": {
"content": "Lorem ipsum...",
"random": "syskehmxsk"
},
"name": "fake-index.md"
},
"statusCode": 201
}
GET /repos/:repoOwner/:repoName/db/trees/:sha1?expand=:levels&format=:format
Request query params
expand=:levels
(non-negative integer, optional): Specifies how many entry levels will be expanded recursively. 0 indicates no expansion.format=:format
(minimal
orhrefs
with optional suffix.v0
; default:hrefs
): Specifies whether the result contains a minimal representation or embedded hrefs.
The optional format
version suffix may only be used with expand=0
.
Children will always be expanded in the format that matches their _idversion
.
Response
Unexpanded:
GET http://localhost:3000/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94?expand=0&format=hrefs
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
},
"_idversion": 0,
"entries": [
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b",
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"type": "object"
},
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"sha1": "b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"type": "object"
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
},
"statusCode": 200
}
Expanded:
GET http://localhost:3000/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94?expand=1&format=hrefs
Status: 200
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
},
"_idversion": 0,
"entries": [
{
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b",
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b"
},
"_idversion": 1,
"blob": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/blobs/3f786850e387550fdab836ed7e6dc881de23001b",
"sha1": "3f786850e387550fdab836ed7e6dc881de23001b"
},
"meta": {
"random": "bukxwstgav",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data",
"text": null
},
{
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"sha1": "b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f"
},
"_idversion": 1,
"blob": null,
"meta": {
"random": "gotlxwjvxj"
},
"name": "index.md",
"text": "Lorem ipsum..."
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
},
"statusCode": 200
}
Expanded, minimal:
GET http://localhost:3000/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94?expand=1&format=minimal
Status: 200
{
"data": {
"_id": "be9cd0d3d9150ac633e317f78d01a71f40077e94",
"_idversion": 0,
"entries": [
{
"_id": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"_idversion": 1,
"blob": "3f786850e387550fdab836ed7e6dc881de23001b",
"meta": {
"random": "bukxwstgav",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data",
"text": null
},
{
"_id": "b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"_idversion": 1,
"blob": null,
"meta": {
"random": "gotlxwjvxj"
},
"name": "index.md",
"text": "Lorem ipsum..."
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
},
"statusCode": 200
}
POST /repos/:repoOwner/:repoName/db/trees?format=:format
Request query params
format=:format
(minimal
orhrefs
; default:hrefs
): Specifies whether the result is a minimal representation or contains embedded hrefs (see example at get)
Request body
The body contains a JSON representation of the tree with the following keys:
tree.name
(String
): The name of the object.tree.meta
(Object
): Meta data that is stored with the object.tree.entries
(Array
of entries): An entry can either be collapsed{"type": <type>, "sha1": <sha1>}
, where<type>
can be'object'
or'tree'
and<sha1>
must be the id of a corresponding entry; or an entry can contain the full content for an object or tree.
There is only a single canonical representation (_idversion: 0
) for trees.
Trees may recursively contain trees up to the total request limit. Consider using a series of bulk posts (see below) if the total tree size exceeds the limit.
Example with collapsed entry:
{
"tree": {
"entries": [
{
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66",
"type": "object"
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
}
}
Example with expanded entry:
{
"tree": {
"entries": [
{
"blob": "3f786850e387550fdab836ed7e6dc881de23001b",
"meta": {
"random": "bukxwstgav",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data"
},
{
"_idversion": 1,
"blob": null,
"meta": {
"random": "gotlxwjvxj"
},
"name": "index.md",
"text": "Lorem ipsum..."
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
}
}
Response
Status: 201
{
"data": {
"_id": {
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/trees/be9cd0d3d9150ac633e317f78d01a71f40077e94",
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94"
},
"_idversion": 0,
"entries": [
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/d46126638a13e0b86adc09d15670c8cfeb19373b",
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"type": "object"
},
{
"href": "https://nog.zib.de/api/repos/fred/hello-world/db/objects/b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"sha1": "b4556ff729e1d49a25cf90c19b5bf8df8ce88a4f",
"type": "object"
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
},
"statusCode": 201
}
POST /repos/:repoOwner/:repoName/db/bulk
Request body
entries
(Array of expanded entries or copy instructions): Expanded entries can be objects, trees, and commits. If entries depend on each other, the entries must be ordered such that entries that depend on other entries come after their dependencies. A special kind of entry can be used to copy content from other repos:{"copy": {"type": String, "sha1": String, "repoFullName": String}}
copies the entry with thesha1
from the repo with namerepoFullName
.type
can beobject
,tree
,commit
, orblob
.
Example:
{
"entries": [
{
"blob": "3f786850e387550fdab836ed7e6dc881de23001b",
"meta": {
"random": "elkqaanymh",
"specimen": "bar",
"study": "foo"
},
"name": "Fake data"
},
{
"entries": [
{
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66",
"type": "object"
}
],
"meta": {
"study": "foo"
},
"name": "Workspace root"
},
{
"message": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed\ndo eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.\n",
"meta": {
"importGitCommit": "1919191919191919191919191919191919191919"
},
"parents": [
"f14b966459667078910b9a8fcf77b5f3228f7f1e"
],
"subject": "Initial commit",
"tree": "5af3a99f790fc7cfee9622b35564585c8d4df64a"
},
{
"copy": {
"repoFullName": "fred/hello-world",
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66",
"type": "object"
}
},
{
"copy": {
"repoFullName": "fred/hello-world",
"sha1": "5af3a99f790fc7cfee9622b35564585c8d4df64a",
"type": "tree"
}
}
]
}
Response
An array of collapsed entries
of format {"type": String, "sha1": String}
.
Status: 201
{
"data": {
"entries": [
{
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66",
"type": "object"
},
{
"sha1": "5af3a99f790fc7cfee9622b35564585c8d4df64a",
"type": "tree"
},
{
"sha1": "a4e46e4265fc4dd0169cdc17001f9275aa739255",
"type": "commit"
},
{
"sha1": "15635f828b11153643f932b3e57fd9f527a4be66",
"type": "object"
},
{
"sha1": "5af3a99f790fc7cfee9622b35564585c8d4df64a",
"type": "tree"
}
]
},
"statusCode": 201
}
POST /repos/:repoOwner/:repoName/db/stat
The method is POST
, because it seems controversial whether request bodies
should be used with GET
.
Request body
entries
(Array of{"type": String, "sha1": String}
): The entries for which status information is requested.type
can beobject
,tree
,commit
, orblob
.sha1
is a hex sha1 id of the entry.
Example:
{
"entries": [
{
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"type": "object"
},
{
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94",
"type": "tree"
},
{
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"type": "commit"
},
{
"sha1": "0123012301230123012301230123012301230123",
"type": "object"
}
]
}
Response
The entries
array that was posted is echoed back with an additional field
status
that contains exists
or unknown
.
Status: 200
{
"data": {
"entries": [
{
"sha1": "d46126638a13e0b86adc09d15670c8cfeb19373b",
"status": "exists",
"type": "object"
},
{
"sha1": "be9cd0d3d9150ac633e317f78d01a71f40077e94",
"status": "exists",
"type": "tree"
},
{
"sha1": "7215f2bb2b2128da2abb00b90e2be2f0274016cc",
"status": "exists",
"type": "commit"
},
{
"sha1": "0123012301230123012301230123012301230123",
"status": "unknown",
"type": "object"
}
]
},
"statusCode": 200
}