From 5fa0f8cd65944cfbf00a48c6c5ec74aa01b264a3 Mon Sep 17 00:00:00 2001 From: Julio Poveda Date: Wed, 13 May 2020 11:50:00 -0500 Subject: [PATCH] Instructions fixes Hello. These are some instructions fixes I propose based on my experience working with the OpenMTC. --- doc/openmtc-get-started.md | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/doc/openmtc-get-started.md b/doc/openmtc-get-started.md index e989d2a..0e89be1 100644 --- a/doc/openmtc-get-started.md +++ b/doc/openmtc-get-started.md @@ -6,12 +6,14 @@ In this short tutorial you will: 2. Create an *application resource* and corresponding *content instance* via the REST API 3. Using the REST API to get this *content instance* -Clone the OpenMTC repository +First, clone the OpenMTC GitHub repository: + ```sh git clone https://github.com/OpenMTC/OpenMTC OpenMTC ``` -All following commands should be executed from within the repo folder +All following commands should be executed from within the repo folder: + ```sh cd OpenMTC ``` @@ -19,7 +21,8 @@ cd OpenMTC The next steps need Docker to be installed on your system. If you need help for the installation, follow [this guide](various.md). -Build the gateway Image +Build the gateway image: + ```sh ./create-binary-docker gateway ``` @@ -30,28 +33,37 @@ To check if this step was successful run: docker image ls ``` -If there is an entry "openmtc/gateway" the image was created successfully. +If there is an "openmtc/gateway-amd64" or "openmtc/gateway-arm" entry, the image was created successfully. Run the gateway Docker image + ```sh docker run -d --name gateway -p 0.0.0.0:8000:8000 \ - -e "LOGGING_LEVEL=DEBUG" openmtc/gateway -vv + -e "LOGGING_LEVEL=DEBUG" openmtc/gateway-amd64 -vv ``` -Create an application resource on your gateway +or + +```sh +docker run -d --name gateway -p 0.0.0.0:8000:8000 \ + -e "LOGGING_LEVEL=DEBUG" openmtc/gateway-arm -vv +``` + +Create an application resource on your gateway: + ```sh curl -X POST localhost:8000/onem2m/ -H "Content-Type: application/vnd.onem2m-res+json" \ -d '{"m2m:ae": {"rn": "EXAMPLE_APP_NAME", "api": "placeholder", "rr": "TRUE"}}' ``` -Create a container resource on your gateway +Create a container resource on your gateway: ```sh curl -X POST localhost:8000/onem2m/EXAMPLE_APP_NAME/ -H "Content-Type: application/vnd.onem2m-res+json" \ -d '{"m2m:cnt": {"rn": "EXAMPLE_CONTAINER_NAME"}}' ``` -Create plain text content +Create plain text content: ```sh curl -X POST localhost:8000/onem2m/EXAMPLE_APP_NAME/EXAMPLE_CONTAINER_NAME/ \ @@ -59,8 +71,9 @@ curl -X POST localhost:8000/onem2m/EXAMPLE_APP_NAME/EXAMPLE_CONTAINER_NAME/ \ -d '{"m2m:cin": {"con": "EXAMPLE_VALUE", "cnf": "text/plain:0"}}' ``` -Get the Content +Get the content: + ```sh -curl -X GET localhost:8000/onem2m/EXAMPLE_APP_NAME/EXAMPLE_CONTAINER_NAME/latest +curl -X GET localhost:8000/onem2m/EXAMPLE_APP_NAME/EXAMPLE_CONTAINER_NAME/la ```