[lxc-devel] [lxd/master] Add basic REST API usage example to README.md

monokal on Github lxc-bot at linuxcontainers.org
Fri Apr 22 20:46:10 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 347 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160422/c2b0487f/attachment.bin>
-------------- next part --------------
From 27b84d63adb961d9988fd2494a0bd38433621242 Mon Sep 17 00:00:00 2001
From: Daniel Middleton <monokal at users.noreply.github.com>
Date: Fri, 22 Apr 2016 21:01:59 +0100
Subject: [PATCH 1/2] Add basic REST API usage example to README.md

---
 README.md | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/README.md b/README.md
index e9c8983..5a77a74 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,39 @@ shell you're going to interact with lxd from.
 After you've got LXD installed and a session with the right permissions, you
 can take your [first steps](#first-steps).
 
+## Using the REST API directly
+Here's a simple example of REST API usage via cURL:
+```bash
+curl -k -L -I \
+    --cert ${LXD_API_CRT} \
+    --key ${LXD_API_KEY} \
+    -H "Content-Type: application/json" \
+    -X POST \
+    -d @hello-ubuntu.json \
+    "${LXD_API_URL}/containers"
+```
+where `hello-ubuntu.json` could contain:
+```json
+{
+    "name":"some-ubuntu",
+    "architecture":"x86_64",
+    "profiles":[
+        "default"
+    ],
+    "ephemeral":true,
+    "config":{
+        "limits.cpu":"2"
+    },
+    "source": {
+        "type":"image",
+        "mode":"pull",
+        "protocol":"simplestreams",
+        "server":"https://cloud-images.ubuntu.com/releases",
+        "alias":"14.04"
+    }
+}
+```
+
 ## Building from source
 
 We recommend having the latest versions of liblxc (>= 1.1 required) and CRIU

From da786080b359dc9743ea9808f8c76725952ff971 Mon Sep 17 00:00:00 2001
From: Daniel Middleton <monokal at users.noreply.github.com>
Date: Fri, 22 Apr 2016 21:44:14 +0100
Subject: [PATCH 2/2] Signed-off-by: Daniel Middleton <d at monokal.io>

Signed-off-by: Daniel Middleton <d at monokal.io>
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 5a77a74..6e4bfda 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ shell you're going to interact with lxd from.
 After you've got LXD installed and a session with the right permissions, you
 can take your [first steps](#first-steps).
 
-## Using the REST API directly
+## Using the REST API
 Here's a simple example of REST API usage via cURL:
 ```bash
 curl -k -L -I \


More information about the lxc-devel mailing list