doc: Try to standardise JSON examples

Fixed:
 * Invalid JSON
 * Inconsistent spacing at colon

Expression for binary data streams (line 468 vs. 1474) remain inconsistent.
Could fix that too, if you like.

Signed-off-by: Lorenz Leutgeb <lorenz.leutgeb@gmail.com>
This commit is contained in:
Lorenz Leutgeb 2015-01-03 18:15:40 +01:00
parent b2ab733c99
commit e583cc1eb4
1 changed files with 143 additions and 144 deletions

View File

@ -40,9 +40,9 @@ List containers
"Command": "echo 1", "Command": "echo 1",
"Created": 1367854155, "Created": 1367854155,
"Status": "Exit 0", "Status": "Exit 0",
"Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
"SizeRw":12288, "SizeRw": 12288,
"SizeRootFs":0 "SizeRootFs": 0
}, },
{ {
"Id": "9cd87474be90", "Id": "9cd87474be90",
@ -50,9 +50,9 @@ List containers
"Command": "echo 222222", "Command": "echo 222222",
"Created": 1367854155, "Created": 1367854155,
"Status": "Exit 0", "Status": "Exit 0",
"Ports":[], "Ports": [],
"SizeRw":12288, "SizeRw": 12288,
"SizeRootFs":0 "SizeRootFs": 0
}, },
{ {
"Id": "3176a2479c92", "Id": "3176a2479c92",
@ -70,9 +70,9 @@ List containers
"Command": "echo 444444444444444444444444444444444", "Command": "echo 444444444444444444444444444444444",
"Created": 1367854152, "Created": 1367854152,
"Status": "Exit 0", "Status": "Exit 0",
"Ports":[], "Ports": [],
"SizeRw":12288, "SizeRw": 12288,
"SizeRootFs":0 "SizeRootFs": 0
} }
] ]
@ -110,42 +110,42 @@ Create a container
Content-Type: application/json Content-Type: application/json
{ {
"Hostname":"", "Hostname": "",
"Domainname": "", "Domainname": "",
"User":"", "User": "",
"Memory":0, "Memory": 0,
"MemorySwap":0, "MemorySwap": 0,
"CpuShares": 512, "CpuShares": 512,
"Cpuset": "0,1", "Cpuset": "0,1",
"AttachStdin":false, "AttachStdin": false,
"AttachStdout":true, "AttachStdout": true,
"AttachStderr":true, "AttachStderr": true,
"Tty":false, "Tty": false,
"OpenStdin":false, "OpenStdin": false,
"StdinOnce":false, "StdinOnce": false,
"Env":null, "Env": null,
"Cmd":[ "Cmd": [
"date" "date"
], ],
"Entrypoint": "", "Entrypoint": "",
"Image":"base", "Image": "base",
"Volumes":{ "Volumes": {
"/tmp": {} "/tmp": {}
}, },
"WorkingDir":"", "WorkingDir": "",
"NetworkDisabled": false, "NetworkDisabled": false,
"MacAddress":"12:34:56:78:9a:bc", "MacAddress": "12:34:56:78:9a:bc",
"ExposedPorts":{ "ExposedPorts": {
"22/tcp": {} "22/tcp": {}
}, },
"SecurityOpts": [""], "SecurityOpts": [""],
"HostConfig": { "HostConfig": {
"Binds":["/tmp:/tmp"], "Binds": ["/tmp:/tmp"],
"Links":["redis3:redis"], "Links": ["redis3:redis"],
"LxcConf":{"lxc.utsname":"docker"}, "LxcConf": {"lxc.utsname":"docker"},
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] }, "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false, "PublishAllPorts": false,
"Privileged":false, "Privileged": false,
"Dns": ["8.8.8.8"], "Dns": ["8.8.8.8"],
"DnsSearch": [""], "DnsSearch": [""],
"VolumesFrom": ["parent", "other:ro"], "VolumesFrom": ["parent", "other:ro"],
@ -163,8 +163,8 @@ Create a container
Content-Type: application/json Content-Type: application/json
{ {
"Id":"f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b" "Id": "f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b"
"Warnings":[] "Warnings": []
} }
Json Parameters: Json Parameters:
@ -291,8 +291,7 @@ Return low-level information on the container `id`
"Image": "base", "Image": "base",
"Volumes": {}, "Volumes": {},
"VolumesFrom": "", "VolumesFrom": "",
"WorkingDir":"" "WorkingDir": ""
}, },
"State": { "State": {
"Running": false, "Running": false,
@ -327,8 +326,8 @@ Return low-level information on the container `id`
}, },
"Links": ["/name:alias"], "Links": ["/name:alias"],
"PublishAllPorts": false, "PublishAllPorts": false,
"CapAdd: ["NET_ADMIN"], "CapAdd": ["NET_ADMIN"],
"CapDrop: ["MKNOD"] "CapDrop": ["MKNOD"]
} }
} }
@ -354,7 +353,7 @@ List processes running inside the container `id`
Content-Type: application/json Content-Type: application/json
{ {
"Titles":[ "Titles": [
"USER", "USER",
"PID", "PID",
"%CPU", "%CPU",
@ -367,7 +366,7 @@ List processes running inside the container `id`
"TIME", "TIME",
"COMMAND" "COMMAND"
], ],
"Processes":[ "Processes": [
["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"], ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"] ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
] ]
@ -432,16 +431,16 @@ Inspect changes on container `id`'s filesystem
[ [
{ {
"Path":"/dev", "Path": "/dev",
"Kind":0 "Kind": 0
}, },
{ {
"Path":"/dev/kmsg", "Path": "/dev/kmsg",
"Kind":1 "Kind": 1
}, },
{ {
"Path":"/test", "Path": "/test",
"Kind":1 "Kind": 1
} }
] ]
@ -508,12 +507,12 @@ Start the container `id`
Content-Type: application/json Content-Type: application/json
{ {
"Binds":["/tmp:/tmp"], "Binds": ["/tmp:/tmp"],
"Links":["redis3:redis"], "Links": ["redis3:redis"],
"LxcConf":{"lxc.utsname":"docker"}, "LxcConf": {"lxc.utsname":"docker"},
"PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] }, "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
"PublishAllPorts":false, "PublishAllPorts": false,
"Privileged":false, "Privileged": false,
"Dns": ["8.8.8.8"], "Dns": ["8.8.8.8"],
"DnsSearch": [""], "DnsSearch": [""],
"VolumesFrom": ["parent", "other:ro"], "VolumesFrom": ["parent", "other:ro"],
@ -783,7 +782,7 @@ Block until container `id` stops, then returns the exit code
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{"StatusCode":0} {"StatusCode": 0}
Status Codes: Status Codes:
@ -831,7 +830,7 @@ Copy files or folders of container `id`
Content-Type: application/json Content-Type: application/json
{ {
"Resource":"test.txt" "Resource": "test.txt"
} }
**Example response**: **Example response**:
@ -909,9 +908,9 @@ Create an image, either by pulling it from the registry or by importing it
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{"status":"Pulling..."} {"status": "Pulling..."}
{"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}} {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
{"error":"Invalid..."} {"error": "Invalid..."}
... ...
When using this endpoint to pull an image from the registry, the When using this endpoint to pull an image from the registry, the
@ -954,31 +953,31 @@ Return low-level information on the image `name`
Content-Type: application/json Content-Type: application/json
{ {
"Created":"2013-03-23T22:24:18.818426-07:00", "Created": "2013-03-23T22:24:18.818426-07:00",
"Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0", "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
"ContainerConfig": "ContainerConfig":
{ {
"Hostname":"", "Hostname": "",
"User":"", "User": "",
"Memory":0, "Memory": 0,
"MemorySwap":0, "MemorySwap": 0,
"AttachStdin":false, "AttachStdin": false,
"AttachStdout":false, "AttachStdout": false,
"AttachStderr":false, "AttachStderr": false,
"PortSpecs":null, "PortSpecs": null,
"Tty":true, "Tty": true,
"OpenStdin":true, "OpenStdin": true,
"StdinOnce":false, "StdinOnce": false,
"Env":null, "Env": null,
"Cmd": ["/bin/bash"], "Cmd": ["/bin/bash"],
"Dns":null, "Dns": null,
"Image":"base", "Image": "base",
"Volumes":null, "Volumes": null,
"VolumesFrom":"", "VolumesFrom": "",
"WorkingDir":"" "WorkingDir": ""
}, },
"Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
"Parent":"27cf784147099545", "Parent": "27cf784147099545",
"Size": 6824592 "Size": 6824592
} }
@ -1005,14 +1004,14 @@ Return the history of the image `name`
[ [
{ {
"Id":"b750fe79269d", "Id": "b750fe79269d",
"Created":1364102658, "Created": 1364102658,
"CreatedBy":"/bin/bash" "CreatedBy": "/bin/bash"
}, },
{ {
"Id":"27cf78414709", "Id": "27cf78414709",
"Created":1364068391, "Created": 1364068391,
"CreatedBy":"" "CreatedBy": ""
} }
] ]
@ -1037,9 +1036,9 @@ Push the image `name` on the registry
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{"status":"Pushing..."} {"status": "Pushing..."}
{"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}} {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
{"error":"Invalid..."} {"error": "Invalid..."}
... ...
If you wish to push an image on to a private registry, that image must already have been tagged If you wish to push an image on to a private registry, that image must already have been tagged
@ -1110,9 +1109,9 @@ Remove the image `name` from the filesystem
Content-type: application/json Content-type: application/json
[ [
{"Untagged":"3e2f21a89f"}, {"Untagged": "3e2f21a89f"},
{"Deleted":"3e2f21a89f"}, {"Deleted": "3e2f21a89f"},
{"Deleted":"53b4f83ac9"} {"Deleted": "53b4f83ac9"}
] ]
Query Parameters: Query Parameters:
@ -1199,9 +1198,9 @@ Build an image from Dockerfile via stdin
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{"stream":"Step 1..."} {"stream": "Step 1..."}
{"stream":"..."} {"stream": "..."}
{"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}} {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
The stream must be a tar archive compressed with one of the The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz. following algorithms: identity (no compression), gzip, bzip2, xz.
@ -1242,10 +1241,10 @@ Get the default username and email
Content-Type: application/json Content-Type: application/json
{ {
"username":"hannibal", "username":" hannibal",
"password:"xxxx", "password: "xxxx",
"email":"hannibal@a-team.com", "email": "hannibal@a-team.com",
"serveraddress":"https://index.docker.io/v1/" "serveraddress": "https://index.docker.io/v1/"
} }
**Example response**: **Example response**:
@ -1274,20 +1273,20 @@ Display system-wide information
Content-Type: application/json Content-Type: application/json
{ {
"Containers":11, "Containers": 11,
"Images":16, "Images": 16,
"Driver":"btrfs", "Driver": "btrfs",
"ExecutionDriver":"native-0.1", "ExecutionDriver": "native-0.1",
"KernelVersion":"3.12.0-1-amd64" "KernelVersion": "3.12.0-1-amd64"
"Debug":false, "Debug": false,
"NFd": 11, "NFd": 11,
"NGoroutines":21, "NGoroutines": 21,
"NEventsListener":0, "NEventsListener": 0,
"InitPath":"/usr/bin/docker", "InitPath": "/usr/bin/docker",
"IndexServerAddress":["https://index.docker.io/v1/"], "IndexServerAddress": ["https://index.docker.io/v1/"],
"MemoryLimit":true, "MemoryLimit": true,
"SwapLimit":false, "SwapLimit": false,
"IPv4Forwarding":true "IPv4Forwarding": true
} }
Status Codes: Status Codes:
@ -1311,10 +1310,10 @@ Show the docker version information
Content-Type: application/json Content-Type: application/json
{ {
"ApiVersion":"1.12", "ApiVersion": "1.12",
"Version":"0.2.2", "Version": "0.2.2",
"GitCommit":"5a2a5cc+CHANGES", "GitCommit": "5a2a5cc+CHANGES",
"GoVersion":"go1.0.3" "GoVersion": "go1.0.3"
} }
Status Codes: Status Codes:
@ -1356,30 +1355,30 @@ Create a new image from a container's changes
Content-Type: application/json Content-Type: application/json
{ {
"Hostname":"", "Hostname": "",
"Domainname": "", "Domainname": "",
"User":"", "User": "",
"Memory":0, "Memory": 0,
"MemorySwap":0, "MemorySwap": 0,
"CpuShares": 512, "CpuShares": 512,
"Cpuset": "0,1", "Cpuset": "0,1",
"AttachStdin":false, "AttachStdin": false,
"AttachStdout":true, "AttachStdout": true,
"AttachStderr":true, "AttachStderr": true,
"PortSpecs":null, "PortSpecs": null,
"Tty":false, "Tty": false,
"OpenStdin":false, "OpenStdin": false,
"StdinOnce":false, "StdinOnce": false,
"Env":null, "Env": null,
"Cmd":[ "Cmd": [
"date" "date"
], ],
"Volumes":{ "Volumes": {
"/tmp": {} "/tmp": {}
}, },
"WorkingDir":"", "WorkingDir": "",
"NetworkDisabled": false, "NetworkDisabled": false,
"ExposedPorts":{ "ExposedPorts": {
"22/tcp": {} "22/tcp": {}
} }
} }
@ -1389,7 +1388,7 @@ Create a new image from a container's changes
HTTP/1.1 201 Created HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream Content-Type: application/vnd.docker.raw-stream
{"Id":"596069db4bf5"} {"Id": "596069db4bf5"}
Json Parameters: Json Parameters:
@ -1434,10 +1433,10 @@ and Docker images will report:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924} {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
{"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924} {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
{"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966} {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
{"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970} {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
Query Parameters: Query Parameters:
@ -1547,7 +1546,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
``` ```
{"hello-world": {"hello-world":
{"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"} {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
} }
``` ```
@ -1563,11 +1562,11 @@ Sets up an exec instance in a running container `id`
Content-Type: application/json Content-Type: application/json
{ {
"AttachStdin":false, "AttachStdin": false,
"AttachStdout":true, "AttachStdout": true,
"AttachStderr":true, "AttachStderr": true,
"Tty":false, "Tty": false,
"Cmd":[ "Cmd": [
"date" "date"
], ],
} }
@ -1578,7 +1577,7 @@ Sets up an exec instance in a running container `id`
Content-Type: application/json Content-Type: application/json
{ {
"Id":"f90e34656806" "Id": "f90e34656806"
} }
Json Parameters: Json Parameters:
@ -1609,8 +1608,8 @@ interactive session with the `exec` command.
Content-Type: application/json Content-Type: application/json
{ {
"Detach":false, "Detach": false,
"Tty":false, "Tty": false,
} }
**Example response**: **Example response**: