Repository: HTTP-APIs/hydrus
Pull request #52 (2017-07-25 10:35:11)

Bugs fixes
- HYDRUS_SERVER_URL context fixed
- Docs updated
- Update setup requirements


Patch:
diff --git a/hydrus/app.py b/hydrus/app.py
index 33e904c..ca30c30 100644
--- a/hydrus/app.py
+++ b/hydrus/app.py
@@ -9,7 +9,7 @@ from sqlalchemy.orm import sessionmaker
 from sqlalchemy.orm.session import Session
 from hydrus.hydraspec.doc_writer import HydraDoc
 from hydrus.metadata.doc_gen import doc_gen
-from hydrus.settings import API_NAME, HYDRUS_SERVER_URL, PORT
+from hydrus.settings import HYDRUS_SERVER_URL, PORT
 from hydrus.data import crud
 from flask_cors import CORS
 from contextlib import contextmanager
@@ -34,6 +34,33 @@ def set_session(application, DB_SESSION):
     with appcontext_pushed.connected_to(handler, application):
         yield
 
+def get_session():
+    """Get the db session for the app with context management."""
+    session = getattr(g, 'dbsession', None)
+    if session is None:
+        session = sessionmaker(bind=engine)()
+        g.dbsession = session
+    return session
+
+
+@contextmanager
+def set_hydrus_server_url(application, HYDRUS_SERVER_URL):
+    """Set the database session for the app along with context management."""
+
+    def handler(sender, **kwargs):
+        g.hydrus_server_url = HYDRUS_SERVER_URL
+    with appcontext_pushed.connected_to(handler, application):
+        yield
+
+
+def get_hydrus_server_url():
+    """Get the db session for the app with context management."""
+    hydrus_server_url = getattr(g, 'hydrus_server_url', None)
+    if hydrus_server_url is None:
+        hydrus_server_url = HYDRUS_SERVER_URL
+        g.hydrus_server_url = hydrus_server_url
+    return hydrus_server_url
+
 
 @contextmanager
 def set_doc(application, APIDOC):
@@ -51,21 +78,12 @@ def get_doc():
     """Get the db session for the app with context management."""
     apidoc = getattr(g, 'doc', None)
     if apidoc is None:
-        apidoc = doc_gen(API_NAME, HYDRUS_SERVER_URL)
+        apidoc = doc_gen(API_NAME, get_hydrus_server_url())
         g.doc = apidoc
     return apidoc
 
-
-def get_session():
-    """Get the db session for the app with context management."""
-    session = getattr(g, 'dbsession', None)
-    if session is None:
-        session = sessionmaker(bind=engine)()
-        g.dbsession = session
-    return session
-
-
-SERVER_URL = HYDRUS_SERVER_URL
+global API_NAME
+API_NAME = "api"
 # set_session(app, sessionmaker(bind=engine)())
 
 
@@ -82,7 +100,7 @@ def set_response_headers(resp, ct="application/ld+json", headers=[], status_code
     for header in headers:
         resp.headers[list(header.keys())[0]] = header[list(header.keys())[0]]
     resp.headers['Content-type'] = ct
-    resp.headers['Link'] = '<' + SERVER_URL + \
+    resp.headers['Link'] = '<' + get_hydrus_server_url() + \
         API_NAME+'/vocab>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"'
     return resp
 
@@ -130,7 +148,7 @@ class Item(Resource):
                 if object_["@type"] == obj_type:
                     response = crud.update(object_=object_, id_=id_, type_=object_["@type"], session=get_session())
                     object_id = response[list(response.keys())[0]].split("=")[1]
-                    headers_ = [{"Location": SERVER_URL+API_NAME+"/"+type_+"/"+str(object_id)}]
+                    headers_ = [{"Location": get_hydrus_server_url()+API_NAME+"/"+type_+"/"+str(object_id)}]
                     status_code = int(list(response.keys())[0])
                     return set_response_headers(jsonify(response), headers=headers_, status_code=status_code)
             return set_response_headers(jsonify({400: "Data is not valid"}), status_code=400)
@@ -145,7 +163,7 @@ class Item(Resource):
             if validObject(object_):
                 if object_["@type"] == obj_type:
                     response = crud.insert(object_=object_, id_=id_, session=get_session())
-                    headers_ = [{"Location": SERVER_URL+API_NAME+"/"+type_+"/"+str(id_)}]
+                    headers_ = [{"Location": get_hydrus_server_url()+API_NAME+"/"+type_+"/"+str(id_)}]
                     status_code = int(list(response.keys())[0])
                     return set_response_headers(jsonify(response), headers=headers_, status_code=status_code)
             return set_response_headers(jsonify({400: "Data is not valid"}), status_code=400)
@@ -183,7 +201,7 @@ class ItemCollection(Resource):
 
             # Non Collection classes
             elif type_ in get_doc().parsed_classes and type_+"Collection" not in get_doc().collections:
-                response = crud.get_single(type_)
+                response = crud.get_single(type_, session=get_session())
                 if len(response.keys()) == 1:
                     status_code = int(list(response.keys())[0])
                     return set_response_headers(jsonify(response), status_code=status_code)
@@ -203,7 +221,7 @@ class ItemCollection(Resource):
                     if object_["@type"] == obj_type:
                         response = crud.insert(object_=object_, session=get_session())
                         object_id = response[list(response.keys())[0]].split('=')[1]
-                        headers_ = [{"Location": SERVER_URL+"api/"+type_+"/"+str(object_id)}]
+                        headers_ = [{"Location": get_hydrus_server_url()+"api/"+type_+"/"+str(object_id)}]
                         status_code = int(list(response.keys())[0])
                         return set_response_headers(jsonify(response), headers=headers_, status_code=status_code)
                 return set_response_headers(jsonify({400: "Data is not valid"}), status_code=400)
@@ -213,7 +231,7 @@ class ItemCollection(Resource):
                 if object_["@type"] == obj_type:
                     if validObject(object_):
                         response = crud.insert_single(object_=object_, session=get_session())
-                        headers_ = [{"Location": SERVER_URL+API_NAME+"/"+type_+"/"}]
+                        headers_ = [{"Location": get_hydrus_server_url()+API_NAME+"/"+type_+"/"}]
                         status_code = int(list(response.keys())[0])
                         return set_response_headers(jsonify(response), headers=headers_, status_code=status_code)
                 return set_response_headers(jsonify({400: "Data is not valid"}), status_code=400)
@@ -228,7 +246,7 @@ class ItemCollection(Resource):
                 if validObject(object_):
                     if object_["@type"] == obj_type:
                         response = crud.update_single(object_=object_, session=get_session())
-                        headers_ = [{"Location": SERVER_URL+API_NAME+"/"+type_+"/"}]
+                        headers_ = [{"Location": get_hydrus_server_url()+API_NAME+"/"+type_+"/"}]
                         status_code = int(list(response.keys())[0])
                         return set_response_headers(jsonify(response), headers=headers_, status_code=status_code)
                 return set_response_headers(jsonify({400: "Data is not valid"}), status_code=400)
diff --git a/hydrus/data/db_models.py b/hydrus/data/db_models.py
index 1a2c0c8..9ce0c51 100644
--- a/hydrus/data/db_models.py
+++ b/hydrus/data/db_models.py
@@ -5,9 +5,9 @@ from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy import Column, Integer, String
 from hydrus.settings import DB_URL
 
-# engine = create_engine(DB_URL)
+engine = create_engine(DB_URL)
 
-engine = create_engine("postgresql://hydra:hailhydra@localhost:5432/hydrus")
+# engine = create_engine("postgresql://hydra:hailhydra@localhost:5432/hydrus")
 Base = declarative_base()
 
 
diff --git a/hydrus/metadata/doc.py b/hydrus/metadata/doc.py
index 157c4d6..b6ca7d7 100644
--- a/hydrus/metadata/doc.py
+++ b/hydrus/metadata/doc.py
@@ -3,1060 +3,1060 @@ Generated API Documentation for Server API using server_doc_gen.py."""
 
 doc = {
     "@context": {
-        "ApiDocumentation": "hydra:ApiDocumentation",
-        "description": "hydra:description",
+        "ApiDocumentation": "hydra:ApiDocumentation", 
+        "description": "hydra:description", 
         "domain": {
-            "@id": "rdfs:domain",
+            "@id": "rdfs:domain", 
             "@type": "@id"
-        },
+        }, 
         "expects": {
-            "@id": "hydra:expects",
+            "@id": "hydra:expects", 
             "@type": "@id"
-        },
-        "hydra": "http://www.w3.org/ns/hydra/core#",
-        "label": "rdfs:label",
-        "method": "hydra:method",
-        "possibleStatus": "hydra:possibleStatus",
+        }, 
+        "hydra": "http://www.w3.org/ns/hydra/core#", 
+        "label": "rdfs:label", 
+        "method": "hydra:method", 
+        "possibleStatus": "hydra:possibleStatus", 
         "property": {
-            "@id": "hydra:property",
+            "@id": "hydra:property", 
             "@type": "@id"
-        },
+        }, 
         "range": {
-            "@id": "rdfs:range",
+            "@id": "rdfs:range", 
             "@type": "@id"
-        },
-        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
-        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
-        "readonly": "hydra:readonly",
-        "required": "hydra:required",
+        }, 
+        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", 
+        "rdfs": "http://www.w3.org/2000/01/rdf-schema#", 
+        "readonly": "hydra:readonly", 
+        "required": "hydra:required", 
         "returns": {
-            "@id": "hydra:returns",
+            "@id": "hydra:returns", 
             "@type": "@id"
-        },
-        "statusCode": "hydra:statusCode",
-        "statusCodes": "hydra:statusCodes",
+        }, 
+        "statusCode": "hydra:statusCode", 
+        "statusCodes": "hydra:statusCodes", 
         "subClassOf": {
-            "@id": "rdfs:subClassOf",
+            "@id": "rdfs:subClassOf", 
             "@type": "@id"
-        },
-        "supportedClass": "hydra:supportedClass",
-        "supportedOperation": "hydra:supportedOperation",
-        "supportedProperty": "hydra:supportedProperty",
-        "title": "hydra:title",
-        "vocab": "http://localhost/serverapi/vocab#",
+        }, 
+        "supportedClass": "hydra:supportedClass", 
+        "supportedOperation": "hydra:supportedOperation", 
+        "supportedProperty": "hydra:supportedProperty", 
+        "title": "hydra:title", 
+        "vocab": "http://localhost:8080/api/vocab#", 
         "writeonly": "hydra:writeonly"
-    },
-    "@id": "http://localhost/serverapi/vocab",
-    "@type": "ApiDocumentation",
-    "description": "API Documentation for the server side system",
-    "possibleStatus": [],
+    }, 
+    "@id": "http://localhost:8080/api/vocab", 
+    "@type": "ApiDocumentation", 
+    "description": "API Documentation for the server side system", 
+    "possibleStatus": [], 
     "supportedClass": [
         {
-            "@id": "vocab:Command",
-            "@type": "hydra:Class",
-            "description": "Class for drone commands",
+            "@id": "vocab:Datastream", 
+            "@type": "hydra:Class", 
+            "description": "Class for a datastream entry", 
             "supportedOperation": [
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
                     "possibleStatus": [
                         {
-                            "description": "Command not found",
+                            "description": "Data not found", 
                             "statusCode": 404
-                        },
+                        }, 
                         {
-                            "description": "Command Returned",
+                            "description": "Data returned", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "vocab:Command",
-                    "title": "GetCommand"
-                },
+                    ], 
+                    "returns": "vocab:Datastream", 
+                    "title": "ReadDatastream"
+                }, 
                 {
-                    "@type": "http://schema.org/AddAction",
-                    "expects": "vocab:Command",
-                    "method": "PUT",
+                    "@type": "http://schema.org/UpdateAction", 
+                    "expects": "vocab:Datastream", 
+                    "method": "POST", 
                     "possibleStatus": [
                         {
-                            "description": "Command added",
-                            "statusCode": 201
+                            "description": "Data updated", 
+                            "statusCode": 200
                         }
-                    ],
-                    "returns": "null",
-                    "title": "AddCommand"
-                },
+                    ], 
+                    "returns": "null", 
+                    "title": "UpdateDatastream"
+                }, 
                 {
-                    "@type": "http://schema.org/DeleteAction",
-                    "expects": "null",
-                    "method": "DELETE",
+                    "@type": "http://schema.org/DeleteAction", 
+                    "expects": "null", 
+                    "method": "DELETE", 
                     "possibleStatus": [
                         {
-                            "description": "Command deleted",
-                            "statusCode": 201
+                            "description": "Data deleted", 
+                            "statusCode": 200
                         }
-                    ],
-                    "returns": "null",
-                    "title": "DeleteCommand"
+                    ], 
+                    "returns": "null", 
+                    "title": "DeleteDatastream"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/identifier",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "DroneID",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/QuantitativeValue", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Temperature", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "vocab:State",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "State",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/identifier", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "DroneID", 
+                    "writeonly": "false"
+                }, 
+                {
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/geo", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Position", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "Command"
-        },
+            ], 
+            "title": "Datastream"
+        }, 
         {
-            "@id": "vocab:Area",
-            "@type": "hydra:Class",
-            "description": "Class for Area of Interest of the server",
+            "@id": "vocab:Area", 
+            "@type": "hydra:Class", 
+            "description": "Class for Area of Interest of the server", 
             "supportedOperation": [
                 {
-                    "@type": "http://schema.org/UpdateAction",
-                    "expects": "vocab:Area",
-                    "method": "POST",
+                    "@type": "http://schema.org/UpdateAction", 
+                    "expects": "vocab:Area", 
+                    "method": "POST", 
                     "possibleStatus": [
                         {
-                            "description": "Area of interest changed",
+                            "description": "Area of interest changed", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "null",
+                    ], 
+                    "returns": "null", 
                     "title": "UpdateArea"
-                },
+                }, 
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
                     "possibleStatus": [
                         {
-                            "description": "Area of interest not found",
+                            "description": "Area of interest not found", 
                             "statusCode": 404
-                        },
+                        }, 
                         {
-                            "description": "Area of interest returned",
+                            "description": "Area of interest returned", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "vocab:Area",
+                    ], 
+                    "returns": "vocab:Area", 
                     "title": "GetArea"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/geo",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "TopLeft",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/geo", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "TopLeft", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/geo",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "BottomRight",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/geo", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "BottomRight", 
                     "writeonly": "false"
                 }
-            ],
+            ], 
             "title": "Area"
-        },
+        }, 
         {
-            "@id": "vocab:Datastream",
-            "@type": "hydra:Class",
-            "description": "Class for a datastream entry",
-            "supportedOperation": [
+            "@id": "vocab:State", 
+            "@type": "hydra:Class", 
+            "description": "Class for drone state objects", 
+            "supportedOperation": [], 
+            "supportedProperty": [
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
-                    "possibleStatus": [
-                        {
-                            "description": "Data not found",
-                            "statusCode": 404
-                        },
-                        {
-                            "description": "Data returned",
-                            "statusCode": 200
-                        }
-                    ],
-                    "returns": "vocab:Datastream",
-                    "title": "ReadDatastream"
-                },
+                    "@type": "SupportedProperty", 
+                    "property": "http://auto.schema.org/speed", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Speed", 
+                    "writeonly": "false"
+                }, 
                 {
-                    "@type": "http://schema.org/UpdateAction",
-                    "expects": "vocab:Datastream",
-                    "method": "POST",
-                    "possibleStatus": [
-                        {
-                            "description": "Data updated",
-                            "statusCode": 200
-                        }
-                    ],
-                    "returns": "null",
-                    "title": "UpdateDatastream"
-                },
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/geo", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Position", 
+                    "writeonly": "false"
+                }, 
                 {
-                    "@type": "http://schema.org/DeleteAction",
-                    "expects": "null",
-                    "method": "DELETE",
-                    "possibleStatus": [
-                        {
-                            "description": "Data deleted",
-                            "statusCode": 200
-                        }
-                    ],
-                    "returns": "null",
-                    "title": "DeleteDatastream"
-                }
-            ],
-            "supportedProperty": [
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/Property", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Direction", 
+                    "writeonly": "false"
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/QuantitativeValue",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Temperature",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/fuelCapacity", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Battery", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/identifier",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "DroneID",
+                    "@type": "SupportedProperty", 
+                    "property": "https://schema.org/status", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "SensorStatus", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/geo",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Position",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/identifier", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "DroneID", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "Datastream"
-        },
+            ], 
+            "title": "State"
+        }, 
         {
-            "@id": "vocab:Drone",
-            "@type": "hydra:Class",
-            "description": "Class for a drone",
+            "@id": "vocab:Drone", 
+            "@type": "hydra:Class", 
+            "description": "Class for a drone", 
             "supportedOperation": [
                 {
-                    "@type": "http://schema.org/UpdateAction",
-                    "expects": "vocab:Drone",
-                    "method": "POST",
+                    "@type": "http://schema.org/UpdateAction", 
+                    "expects": "vocab:Drone", 
+                    "method": "POST", 
                     "possibleStatus": [
                         {
-                            "description": "Drone updated",
+                            "description": "Drone updated", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "null",
+                    ], 
+                    "returns": "null", 
                     "title": "SubmitDrone"
-                },
+                }, 
                 {
-                    "@type": "http://schema.org/AddAction",
-                    "expects": "vocab:Drone",
-                    "method": "PUT",
+                    "@type": "http://schema.org/AddAction", 
+                    "expects": "vocab:Drone", 
+                    "method": "PUT", 
                     "possibleStatus": [
                         {
-                            "description": "Drone added",
+                            "description": "Drone added", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "null",
+                    ], 
+                    "returns": "null", 
                     "title": "CreateDrone"
-                },
+                }, 
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
                     "possibleStatus": [
                         {
-                            "description": "Drone not found",
+                            "description": "Drone not found", 
                             "statusCode": 404
-                        },
+                        }, 
                         {
-                            "description": "Drone Returned",
+                            "description": "Drone Returned", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "vocab:Drone",
+                    ], 
+                    "returns": "vocab:Drone", 
                     "title": "GetDrone"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "vocab:State",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "DroneState",
+                    "@type": "SupportedProperty", 
+                    "property": "vocab:State", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "DroneState", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/name",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "name",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/name", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "name", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/model",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "model",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/model", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "model", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://auto.schema.org/speed",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "MaxSpeed",
+                    "@type": "SupportedProperty", 
+                    "property": "http://auto.schema.org/speed", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "MaxSpeed", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/device",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Sensor",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/device", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "Sensor", 
                     "writeonly": "false"
                 }
-            ],
+            ], 
             "title": "Drone"
-        },
-        {
-            "@id": "vocab:State",
-            "@type": "hydra:Class",
-            "description": "Class for drone state objects",
-            "supportedOperation": [],
-            "supportedProperty": [
-                {
-                    "@type": "SupportedProperty",
-                    "property": "http://auto.schema.org/speed",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Speed",
-                    "writeonly": "false"
-                },
-                {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/geo",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Position",
-                    "writeonly": "false"
-                },
-                {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/Property",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Direction",
-                    "writeonly": "false"
-                },
-                {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/fuelCapacity",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "Battery",
-                    "writeonly": "false"
-                },
-                {
-                    "@type": "SupportedProperty",
-                    "property": "https://schema.org/status",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "SensorStatus",
-                    "writeonly": "false"
-                },
-                {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/identifier",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "DroneID",
-                    "writeonly": "false"
-                }
-            ],
-            "title": "State"
-        },
+        }, 
         {
-            "@id": "vocab:Message",
-            "@type": "hydra:Class",
-            "description": "Class for messages received by the GUI interface",
+            "@id": "vocab:Command", 
+            "@type": "hydra:Class", 
+            "description": "Class for drone commands", 
             "supportedOperation": [
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
                     "possibleStatus": [
                         {
-                            "description": "Message not found",
+                            "description": "Command not found", 
                             "statusCode": 404
-                        },
+                        }, 
                         {
-                            "description": "Message returned",
+                            "description": "Command Returned", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "vocab:Message",
-                    "title": "GetMessage"
-                },
+                    ], 
+                    "returns": "vocab:Command", 
+                    "title": "GetCommand"
+                }, 
                 {
-                    "@type": "http://schema.org/DeleteAction",
-                    "expects": "null",
-                    "method": "DELETE",
+                    "@type": "http://schema.org/AddAction", 
+                    "expects": "vocab:Command", 
+                    "method": "PUT", 
                     "possibleStatus": [
                         {
-                            "description": "Message deleted",
-                            "statusCode": 200
+                            "description": "Command added", 
+                            "statusCode": 201
                         }
-                    ],
-                    "returns": "null",
-                    "title": "DeleteMessage"
+                    ], 
+                    "returns": "null", 
+                    "title": "AddCommand"
+                }, 
+                {
+                    "@type": "http://schema.org/DeleteAction", 
+                    "expects": "null", 
+                    "method": "DELETE", 
+                    "possibleStatus": [
+                        {
+                            "description": "Command deleted", 
+                            "statusCode": 201
+                        }
+                    ], 
+                    "returns": "null", 
+                    "title": "DeleteCommand"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/Text",
-                    "readonly": "false",
-                    "required": "true",
-                    "title": "MessageString",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/identifier", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "DroneID", 
+                    "writeonly": "false"
+                }, 
+                {
+                    "@type": "SupportedProperty", 
+                    "property": "vocab:State", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "State", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "Message"
-        },
+            ], 
+            "title": "Command"
+        }, 
         {
-            "@id": "vocab:LogEntry",
-            "@type": "hydra:Class",
-            "description": "Class for a log entry",
+            "@id": "vocab:LogEntry", 
+            "@type": "hydra:Class", 
+            "description": "Class for a log entry", 
             "supportedOperation": [
                 {
-                    "@type": "hydra:Operation",
-                    "expects": "null",
-                    "method": "GET",
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
                     "possibleStatus": [
                         {
-                            "description": "Log entry not found",
+                            "description": "Log entry not found", 
                             "statusCode": 404
-                        },
+                        }, 
                         {
-                            "description": "Log entry returned",
+                            "description": "Log entry returned", 
                             "statusCode": 200
                         }
-                    ],
-                    "returns": "vocab:LogEntry",
+                    ], 
+                    "returns": "vocab:LogEntry", 
                     "title": "GetLog"
-                },
+                }, 
                 {
-                    "@type": "http://schema.org/AddAction",
-                    "expects": "vocab:LogEntry",
-                    "method": "PUT",
+                    "@type": "http://schema.org/AddAction", 
+                    "expects": "vocab:LogEntry", 
+                    "method": "PUT", 
                     "possibleStatus": [
                         {
-                            "description": "Log entry created",
+                            "description": "Log entry created", 
                             "statusCode": 201
                         }
-                    ],
-                    "returns": "null",
+                    ], 
+                    "returns": "null", 
                     "title": "AddLog"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/identifier",
-                    "readonly": "true",
-                    "required": "false",
-                    "title": "DroneID",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/identifier", 
+                    "readonly": "true", 
+                    "required": "false", 
+                    "title": "DroneID", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/UpdateAction",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "Update",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/UpdateAction", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "Update", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/ReplyAction",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "Get",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/ReplyAction", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "Get", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://schema.org/SendAction",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "Send",
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/SendAction", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "Send", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "vocab:State",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "State",
+                    "@type": "SupportedProperty", 
+                    "property": "vocab:State", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "State", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "vocab:Datastream",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "Data",
+                    "@type": "SupportedProperty", 
+                    "property": "vocab:Datastream", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "Data", 
                     "writeonly": "true"
-                },
+                }, 
                 {
-                    "@type": "SupportedProperty",
-                    "property": "vocab:Command",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "Command",
+                    "@type": "SupportedProperty", 
+                    "property": "vocab:Command", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "Command", 
                     "writeonly": "true"
                 }
-            ],
+            ], 
             "title": "LogEntry"
-        },
+        }, 
+        {
+            "@id": "vocab:Message", 
+            "@type": "hydra:Class", 
+            "description": "Class for messages received by the GUI interface", 
+            "supportedOperation": [
+                {
+                    "@type": "hydra:Operation", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "possibleStatus": [
+                        {
+                            "description": "Message not found", 
+                            "statusCode": 404
+                        }, 
+                        {
+                            "description": "Message returned", 
+                            "statusCode": 200
+                        }
+                    ], 
+                    "returns": "vocab:Message", 
+                    "title": "GetMessage"
+                }, 
+                {
+                    "@type": "http://schema.org/DeleteAction", 
+                    "expects": "null", 
+                    "method": "DELETE", 
+                    "possibleStatus": [
+                        {
+                            "description": "Message deleted", 
+                            "statusCode": 200
+                        }
+                    ], 
+                    "returns": "null", 
+                    "title": "DeleteMessage"
+                }
+            ], 
+            "supportedProperty": [
+                {
+                    "@type": "SupportedProperty", 
+                    "property": "http://schema.org/Text", 
+                    "readonly": "false", 
+                    "required": "true", 
+                    "title": "MessageString", 
+                    "writeonly": "false"
+                }
+            ], 
+            "title": "Message"
+        }, 
         {
-            "@id": "http://www.w3.org/ns/hydra/core#Resource",
-            "@type": "hydra:Class",
-            "description": "null",
-            "supportedOperation": [],
-            "supportedProperty": [],
+            "@id": "http://www.w3.org/ns/hydra/core#Resource", 
+            "@type": "hydra:Class", 
+            "description": "null", 
+            "supportedOperation": [], 
+            "supportedProperty": [], 
             "title": "Resource"
-        },
+        }, 
         {
-            "@id": "http://www.w3.org/ns/hydra/core#Collection",
-            "@type": "hydra:Class",
-            "description": "null",
-            "supportedOperation": [],
+            "@id": "http://www.w3.org/ns/hydra/core#Collection", 
+            "@type": "hydra:Class", 
+            "description": "null", 
+            "supportedOperation": [], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "null",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "null", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
+            ], 
             "title": "Collection"
-        },
+        }, 
         {
-            "@id": "vocab:DroneCollection",
-            "@type": "hydra:Class",
-            "description": "A collection of drone",
-            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection",
+            "@id": "vocab:DatastreamCollection", 
+            "@type": "hydra:Class", 
+            "description": "A collection of datastream", 
+            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection", 
             "supportedOperation": [
                 {
-                    "@id": "_:drone_collection_retrieve",
-                    "@type": "hydra:Operation",
-                    "description": "Retrieves all Drone entities",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "vocab:DroneCollection",
+                    "@id": "_:datastream_collection_retrieve", 
+                    "@type": "hydra:Operation", 
+                    "description": "Retrieves all Datastream entities", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "vocab:DatastreamCollection", 
                     "statusCodes": []
-                },
-                {
-                    "@id": "_:drone_create",
-                    "@type": "http://schema.org/AddAction",
-                    "description": "Create new Drone entitity",
-                    "expects": "vocab:Drone",
-                    "method": "PUT",
-                    "returns": "vocab:Drone",
+                }, 
+                {
+                    "@id": "_:datastream_create", 
+                    "@type": "http://schema.org/AddAction", 
+                    "description": "Create new Datastream entitity", 
+                    "expects": "vocab:Datastream", 
+                    "method": "PUT", 
+                    "returns": "vocab:Datastream", 
                     "statusCodes": [
                         {
-                            "description": "If the Drone entity was created successfully.",
+                            "description": "If the Datastream entity was created successfully.", 
                             "statusCode": 201
                         }
                     ]
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "description": "The drone",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "description": "The datastream", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "DroneCollection"
-        },
+            ], 
+            "title": "DatastreamCollection"
+        }, 
         {
-            "@id": "vocab:CommandCollection",
-            "@type": "hydra:Class",
-            "description": "A collection of command",
-            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection",
+            "@id": "vocab:DroneCollection", 
+            "@type": "hydra:Class", 
+            "description": "A collection of drone", 
+            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection", 
             "supportedOperation": [
                 {
-                    "@id": "_:command_collection_retrieve",
-                    "@type": "hydra:Operation",
-                    "description": "Retrieves all Command entities",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "vocab:CommandCollection",
+                    "@id": "_:drone_collection_retrieve", 
+                    "@type": "hydra:Operation", 
+                    "description": "Retrieves all Drone entities", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "vocab:DroneCollection", 
                     "statusCodes": []
-                },
-                {
-                    "@id": "_:command_create",
-                    "@type": "http://schema.org/AddAction",
-                    "description": "Create new Command entitity",
-                    "expects": "vocab:Command",
-                    "method": "PUT",
-                    "returns": "vocab:Command",
+                }, 
+                {
+                    "@id": "_:drone_create", 
+                    "@type": "http://schema.org/AddAction", 
+                    "description": "Create new Drone entitity", 
+                    "expects": "vocab:Drone", 
+                    "method": "PUT", 
+                    "returns": "vocab:Drone", 
                     "statusCodes": [
                         {
-                            "description": "If the Command entity was created successfully.",
+                            "description": "If the Drone entity was created successfully.", 
                             "statusCode": 201
                         }
                     ]
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "description": "The command",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "description": "The drone", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "CommandCollection"
-        },
+            ], 
+            "title": "DroneCollection"
+        }, 
         {
-            "@id": "vocab:LogEntryCollection",
-            "@type": "hydra:Class",
-            "description": "A collection of logentry",
-            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection",
+            "@id": "vocab:MessageCollection", 
+            "@type": "hydra:Class", 
+            "description": "A collection of message", 
+            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection", 
             "supportedOperation": [
                 {
-                    "@id": "_:logentry_collection_retrieve",
-                    "@type": "hydra:Operation",
-                    "description": "Retrieves all LogEntry entities",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "vocab:LogEntryCollection",
+                    "@id": "_:message_collection_retrieve", 
+                    "@type": "hydra:Operation", 
+                    "description": "Retrieves all Message entities", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "vocab:MessageCollection", 
                     "statusCodes": []
-                },
-                {
-                    "@id": "_:logentry_create",
-                    "@type": "http://schema.org/AddAction",
-                    "description": "Create new LogEntry entitity",
-                    "expects": "vocab:LogEntry",
-                    "method": "PUT",
-                    "returns": "vocab:LogEntry",
+                }, 
+                {
+                    "@id": "_:message_create", 
+                    "@type": "http://schema.org/AddAction", 
+                    "description": "Create new Message entitity", 
+                    "expects": "vocab:Message", 
+                    "method": "PUT", 
+                    "returns": "vocab:Message", 
                     "statusCodes": [
                         {
-                            "description": "If the LogEntry entity was created successfully.",
+                            "description": "If the Message entity was created successfully.", 
                             "statusCode": 201
                         }
                     ]
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "description": "The logentry",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "description": "The message", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "LogEntryCollection"
-        },
+            ], 
+            "title": "MessageCollection"
+        }, 
         {
-            "@id": "vocab:MessageCollection",
-            "@type": "hydra:Class",
-            "description": "A collection of message",
-            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection",
+            "@id": "vocab:LogEntryCollection", 
+            "@type": "hydra:Class", 
+            "description": "A collection of logentry", 
+            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection", 
             "supportedOperation": [
                 {
-                    "@id": "_:message_collection_retrieve",
-                    "@type": "hydra:Operation",
-                    "description": "Retrieves all Message entities",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "vocab:MessageCollection",
+                    "@id": "_:logentry_collection_retrieve", 
+                    "@type": "hydra:Operation", 
+                    "description": "Retrieves all LogEntry entities", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "vocab:LogEntryCollection", 
                     "statusCodes": []
-                },
-                {
-                    "@id": "_:message_create",
-                    "@type": "http://schema.org/AddAction",
-                    "description": "Create new Message entitity",
-                    "expects": "vocab:Message",
-                    "method": "PUT",
-                    "returns": "vocab:Message",
+                }, 
+                {
+                    "@id": "_:logentry_create", 
+                    "@type": "http://schema.org/AddAction", 
+                    "description": "Create new LogEntry entitity", 
+                    "expects": "vocab:LogEntry", 
+                    "method": "PUT", 
+                    "returns": "vocab:LogEntry", 
                     "statusCodes": [
                         {
-                            "description": "If the Message entity was created successfully.",
+                            "description": "If the LogEntry entity was created successfully.", 
                             "statusCode": 201
                         }
                     ]
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "description": "The message",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "description": "The logentry", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "MessageCollection"
-        },
+            ], 
+            "title": "LogEntryCollection"
+        }, 
         {
-            "@id": "vocab:DatastreamCollection",
-            "@type": "hydra:Class",
-            "description": "A collection of datastream",
-            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection",
+            "@id": "vocab:CommandCollection", 
+            "@type": "hydra:Class", 
+            "description": "A collection of command", 
+            "subClassOf": "http://www.w3.org/ns/hydra/core#Collection", 
             "supportedOperation": [
                 {
-                    "@id": "_:datastream_collection_retrieve",
-                    "@type": "hydra:Operation",
-                    "description": "Retrieves all Datastream entities",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "vocab:DatastreamCollection",
+                    "@id": "_:command_collection_retrieve", 
+                    "@type": "hydra:Operation", 
+                    "description": "Retrieves all Command entities", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "vocab:CommandCollection", 
                     "statusCodes": []
-                },
-                {
-                    "@id": "_:datastream_create",
-                    "@type": "http://schema.org/AddAction",
-                    "description": "Create new Datastream entitity",
-                    "expects": "vocab:Datastream",
-                    "method": "PUT",
-                    "returns": "vocab:Datastream",
+                }, 
+                {
+                    "@id": "_:command_create", 
+                    "@type": "http://schema.org/AddAction", 
+                    "description": "Create new Command entitity", 
+                    "expects": "vocab:Command", 
+                    "method": "PUT", 
+                    "returns": "vocab:Command", 
                     "statusCodes": [
                         {
-                            "description": "If the Datastream entity was created successfully.",
+                            "description": "If the Command entity was created successfully.", 
                             "statusCode": 201
                         }
                     ]
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "@type": "SupportedProperty",
-                    "description": "The datastream",
-                    "property": "http://www.w3.org/ns/hydra/core#member",
-                    "readonly": "false",
-                    "required": "false",
-                    "title": "members",
+                    "@type": "SupportedProperty", 
+                    "description": "The command", 
+                    "property": "http://www.w3.org/ns/hydra/core#member", 
+                    "readonly": "false", 
+                    "required": "false", 
+                    "title": "members", 
                     "writeonly": "false"
                 }
-            ],
-            "title": "DatastreamCollection"
-        },
+            ], 
+            "title": "CommandCollection"
+        }, 
         {
-            "@id": "vocab:EntryPoint",
-            "@type": "hydra:Class",
-            "description": "The main entry point or homepage of the API.",
+            "@id": "vocab:EntryPoint", 
+            "@type": "hydra:Class", 
+            "description": "The main entry point or homepage of the API.", 
             "supportedOperation": [
                 {
-                    "@id": "_:entry_point",
-                    "@type": "hydra:Operation",
-                    "description": "The APIs main entry point.",
-                    "expects": "null",
-                    "method": "GET",
-                    "returns": "null",
+                    "@id": "_:entry_point", 
+                    "@type": "hydra:Operation", 
+                    "description": "The APIs main entry point.", 
+                    "expects": "null", 
+                    "method": "GET", 
+                    "returns": "null", 
                     "statusCodes": "vocab:EntryPoint"
                 }
-            ],
+            ], 
             "supportedProperty": [
                 {
-                    "hydra:description": "The Area Class",
-                    "hydra:title": "area",
+                    "hydra:description": "The Area Class", 
+                    "hydra:title": "area", 
                     "property": {
-                        "@id": "vocab:EntryPoint/Area",
-                        "@type": "hydra:Link",
-                        "description": "Class for Area of Interest of the server",
-                        "domain": "vocab:EntryPoint",
-                        "label": "Area",
-                        "range": "vocab:Area",
+                        "@id": "vocab:EntryPoint/Area", 
+                        "@type": "hydra:Link", 
+                        "description": "Class for Area of Interest of the server", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "Area", 
+                        "range": "vocab:Area", 
                         "supportedOperation": [
                             {
-                                "@id": "_:updatearea",
-                                "@type": "hydra:Operation",
-                                "description": "null",
-                                "expects": "vocab:Area",
-                                "label": "UpdateArea",
-                                "method": "POST",
-                                "returns": "null",
+                                "@id": "_:updatearea", 
+                                "@type": "hydra:Operation", 
+                                "description": "null", 
+                                "expects": "vocab:Area", 
+                                "label": "UpdateArea", 
+                                "method": "POST", 
+                                "returns": "null", 
                                 "statusCodes": [
                                     {
-                                        "description": "Area of interest changed",
+                                        "description": "Area of interest changed", 
                                         "statusCode": 200
                                     }
                                 ]
-                            },
+                            }, 
                             {
-                                "@id": "_:getarea",
-                                "@type": "hydra:Operation",
-                                "description": "null",
-                                "expects": "null",
-                                "label": "GetArea",
-                                "method": "GET",
-                                "returns": "vocab:Area",
+                                "@id": "_:getarea", 
+                                "@type": "hydra:Operation", 
+                                "description": "null", 
+                                "expects": "null", 
+                                "label": "GetArea", 
+                                "method": "GET", 
+                                "returns": "vocab:Area", 
                                 "statusCodes": [
                                     {
-                                        "description": "Area of interest not found",
+                                        "description": "Area of interest not found", 
                                         "statusCode": 404
-                                    },
+                                    }, 
                                     {
-                                        "description": "Area of interest returned",
+                                        "description": "Area of interest returned", 
                                         "statusCode": 200
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "hydra:description": "The DroneCollection collection",
-                    "hydra:title": "dronecollection",
+                    "hydra:description": "The DatastreamCollection collection", 
+                    "hydra:title": "datastreamcollection", 
                     "property": {
-                        "@id": "vocab:EntryPoint/DroneCollection",
-                        "@type": "hydra:Link",
-                        "description": "The DroneCollection collection",
-                        "domain": "vocab:EntryPoint",
-                        "label": "DroneCollection",
-                        "range": "vocab:DroneCollection",
+                        "@id": "vocab:EntryPoint/DatastreamCollection", 
+                        "@type": "hydra:Link", 
+                        "description": "The DatastreamCollection collection", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "DatastreamCollection", 
+                        "range": "vocab:DatastreamCollection", 
                         "supportedOperation": [
                             {
-                                "@id": "_:_:drone_collection_retrieve",
-                                "@type": "hydra:Operation",
-                                "description": "Retrieves all Drone entities",
-                                "expects": "null",
-                                "method": "GET",
-                                "returns": "vocab:DroneCollection",
+                                "@id": "_:_:datastream_collection_retrieve", 
+                                "@type": "hydra:Operation", 
+                                "description": "Retrieves all Datastream entities", 
+                                "expects": "null", 
+                                "method": "GET", 
+                                "returns": "vocab:DatastreamCollection", 
                                 "statusCodes": []
-                            },
+                            }, 
                             {
-                                "@id": "_:_:drone_create",
-                                "@type": "http://schema.org/AddAction",
-                                "description": "Create new Drone entitity",
-                                "expects": "vocab:Drone",
-                                "method": "PUT",
-                                "returns": "vocab:Drone",
+                                "@id": "_:_:datastream_create", 
+                                "@type": "http://schema.org/AddAction", 
+                                "description": "Create new Datastream entitity", 
+                                "expects": "vocab:Datastream", 
+                                "method": "PUT", 
+                                "returns": "vocab:Datastream", 
                                 "statusCodes": [
                                     {
-                                        "description": "If the Drone entity was created successfully.",
+                                        "description": "If the Datastream entity was created successfully.", 
                                         "statusCode": 201
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "hydra:description": "The CommandCollection collection",
-                    "hydra:title": "commandcollection",
+                    "hydra:description": "The DroneCollection collection", 
+                    "hydra:title": "dronecollection", 
                     "property": {
-                        "@id": "vocab:EntryPoint/CommandCollection",
-                        "@type": "hydra:Link",
-                        "description": "The CommandCollection collection",
-                        "domain": "vocab:EntryPoint",
-                        "label": "CommandCollection",
-                        "range": "vocab:CommandCollection",
+                        "@id": "vocab:EntryPoint/DroneCollection", 
+                        "@type": "hydra:Link", 
+                        "description": "The DroneCollection collection", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "DroneCollection", 
+                        "range": "vocab:DroneCollection", 
                         "supportedOperation": [
                             {
-                                "@id": "_:_:command_collection_retrieve",
-                                "@type": "hydra:Operation",
-                                "description": "Retrieves all Command entities",
-                                "expects": "null",
-                                "method": "GET",
-                                "returns": "vocab:CommandCollection",
+                                "@id": "_:_:drone_collection_retrieve", 
+                                "@type": "hydra:Operation", 
+                                "description": "Retrieves all Drone entities", 
+                                "expects": "null", 
+                                "method": "GET", 
+                                "returns": "vocab:DroneCollection", 
                                 "statusCodes": []
-                            },
+                            }, 
                             {
-                                "@id": "_:_:command_create",
-                                "@type": "http://schema.org/AddAction",
-                                "description": "Create new Command entitity",
-                                "expects": "vocab:Command",
-                                "method": "PUT",
-                                "returns": "vocab:Command",
+                                "@id": "_:_:drone_create", 
+                                "@type": "http://schema.org/AddAction", 
+                                "description": "Create new Drone entitity", 
+                                "expects": "vocab:Drone", 
+                                "method": "PUT", 
+                                "returns": "vocab:Drone", 
                                 "statusCodes": [
                                     {
-                                        "description": "If the Command entity was created successfully.",
+                                        "description": "If the Drone entity was created successfully.", 
                                         "statusCode": 201
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "hydra:description": "The LogEntryCollection collection",
-                    "hydra:title": "logentrycollection",
+                    "hydra:description": "The MessageCollection collection", 
+                    "hydra:title": "messagecollection", 
                     "property": {
-                        "@id": "vocab:EntryPoint/LogEntryCollection",
-                        "@type": "hydra:Link",
-                        "description": "The LogEntryCollection collection",
-                        "domain": "vocab:EntryPoint",
-                        "label": "LogEntryCollection",
-                        "range": "vocab:LogEntryCollection",
+                        "@id": "vocab:EntryPoint/MessageCollection", 
+                        "@type": "hydra:Link", 
+                        "description": "The MessageCollection collection", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "MessageCollection", 
+                        "range": "vocab:MessageCollection", 
                         "supportedOperation": [
                             {
-                                "@id": "_:_:logentry_collection_retrieve",
-                                "@type": "hydra:Operation",
-                                "description": "Retrieves all LogEntry entities",
-                                "expects": "null",
-                                "method": "GET",
-                                "returns": "vocab:LogEntryCollection",
+                                "@id": "_:_:message_collection_retrieve", 
+                                "@type": "hydra:Operation", 
+                                "description": "Retrieves all Message entities", 
+                                "expects": "null", 
+                                "method": "GET", 
+                                "returns": "vocab:MessageCollection", 
                                 "statusCodes": []
-                            },
+                            }, 
                             {
-                                "@id": "_:_:logentry_create",
-                                "@type": "http://schema.org/AddAction",
-                                "description": "Create new LogEntry entitity",
-                                "expects": "vocab:LogEntry",
-                                "method": "PUT",
-                                "returns": "vocab:LogEntry",
+                                "@id": "_:_:message_create", 
+                                "@type": "http://schema.org/AddAction", 
+                                "description": "Create new Message entitity", 
+                                "expects": "vocab:Message", 
+                                "method": "PUT", 
+                                "returns": "vocab:Message", 
                                 "statusCodes": [
                                     {
-                                        "description": "If the LogEntry entity was created successfully.",
+                                        "description": "If the Message entity was created successfully.", 
                                         "statusCode": 201
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "hydra:description": "The MessageCollection collection",
-                    "hydra:title": "messagecollection",
+                    "hydra:description": "The LogEntryCollection collection", 
+                    "hydra:title": "logentrycollection", 
                     "property": {
-                        "@id": "vocab:EntryPoint/MessageCollection",
-                        "@type": "hydra:Link",
-                        "description": "The MessageCollection collection",
-                        "domain": "vocab:EntryPoint",
-                        "label": "MessageCollection",
-                        "range": "vocab:MessageCollection",
+                        "@id": "vocab:EntryPoint/LogEntryCollection", 
+                        "@type": "hydra:Link", 
+                        "description": "The LogEntryCollection collection", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "LogEntryCollection", 
+                        "range": "vocab:LogEntryCollection", 
                         "supportedOperation": [
                             {
-                                "@id": "_:_:message_collection_retrieve",
-                                "@type": "hydra:Operation",
-                                "description": "Retrieves all Message entities",
-                                "expects": "null",
-                                "method": "GET",
-                                "returns": "vocab:MessageCollection",
+                                "@id": "_:_:logentry_collection_retrieve", 
+                                "@type": "hydra:Operation", 
+                                "description": "Retrieves all LogEntry entities", 
+                                "expects": "null", 
+                                "method": "GET", 
+                                "returns": "vocab:LogEntryCollection", 
                                 "statusCodes": []
-                            },
+                            }, 
                             {
-                                "@id": "_:_:message_create",
-                                "@type": "http://schema.org/AddAction",
-                                "description": "Create new Message entitity",
-                                "expects": "vocab:Message",
-                                "method": "PUT",
-                                "returns": "vocab:Message",
+                                "@id": "_:_:logentry_create", 
+                                "@type": "http://schema.org/AddAction", 
+                                "description": "Create new LogEntry entitity", 
+                                "expects": "vocab:LogEntry", 
+                                "method": "PUT", 
+                                "returns": "vocab:LogEntry", 
                                 "statusCodes": [
                                     {
-                                        "description": "If the Message entity was created successfully.",
+                                        "description": "If the LogEntry entity was created successfully.", 
                                         "statusCode": 201
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
-                },
+                }, 
                 {
-                    "hydra:description": "The DatastreamCollection collection",
-                    "hydra:title": "datastreamcollection",
+                    "hydra:description": "The CommandCollection collection", 
+                    "hydra:title": "commandcollection", 
                     "property": {
-                        "@id": "vocab:EntryPoint/DatastreamCollection",
-                        "@type": "hydra:Link",
-                        "description": "The DatastreamCollection collection",
-                        "domain": "vocab:EntryPoint",
-                        "label": "DatastreamCollection",
-                        "range": "vocab:DatastreamCollection",
+                        "@id": "vocab:EntryPoint/CommandCollection", 
+                        "@type": "hydra:Link", 
+                        "description": "The CommandCollection collection", 
+                        "domain": "vocab:EntryPoint", 
+                        "label": "CommandCollection", 
+                        "range": "vocab:CommandCollection", 
                         "supportedOperation": [
                             {
-                                "@id": "_:_:datastream_collection_retrieve",
-                                "@type": "hydra:Operation",
-                                "description": "Retrieves all Datastream entities",
-                                "expects": "null",
-                                "method": "GET",
-                                "returns": "vocab:DatastreamCollection",
+                                "@id": "_:_:command_collection_retrieve", 
+                                "@type": "hydra:Operation", 
+                                "description": "Retrieves all Command entities", 
+                                "expects": "null", 
+                                "method": "GET", 
+                                "returns": "vocab:CommandCollection", 
                                 "statusCodes": []
-                            },
+                            }, 
                             {
-                                "@id": "_:_:datastream_create",
-                                "@type": "http://schema.org/AddAction",
-                                "description": "Create new Datastream entitity",
-                                "expects": "vocab:Datastream",
-                                "method": "PUT",
-                                "returns": "vocab:Datastream",
+                                "@id": "_:_:command_create", 
+                                "@type": "http://schema.org/AddAction", 
+                                "description": "Create new Command entitity", 
+                                "expects": "vocab:Command", 
+                                "method": "PUT", 
+                                "returns": "vocab:Command", 
                                 "statusCodes": [
                                     {
-                                        "description": "If the Datastream entity was created successfully.",
+                                        "description": "If the Command entity was created successfully.", 
                                         "statusCode": 201
                                     }
                                 ]
                             }
                         ]
-                    },
-                    "readonly": "true",
-                    "required": "null",
+                    }, 
+                    "readonly": "true", 
+                    "required": "null", 
                     "writeonly": "false"
                 }
-            ],
+            ], 
             "title": "EntryPoint"
         }
-    ],
+    ], 
     "title": "API Doc for the server side API"
-}
+}
\ No newline at end of file
diff --git a/hydrus/metadata/doc_gen.py b/hydrus/metadata/doc_gen.py
index fa3724c..b378d51 100644
--- a/hydrus/metadata/doc_gen.py
+++ b/hydrus/metadata/doc_gen.py
@@ -169,7 +169,7 @@ def doc_gen(API, BASE_URL):
 
 
 if __name__ == "__main__":
-    dump = json.dumps(doc_gen("serverapi", "http://localhost/").generate(), indent=4, sort_keys=True)
+    dump = json.dumps(doc_gen("api", "http://localhost:8080/").generate(), indent=4, sort_keys=True)
     doc = '''"""\nGenerated API Documentation for Server API using server_doc_gen.py."""\n\ndoc = %s''' % dump
     doc = doc.replace('true', '"true"')
     doc = doc.replace('false', '"false"')
diff --git a/hydrus/settings.py b/hydrus/settings.py
index 6b42731..1c568e2 100644
--- a/hydrus/settings.py
+++ b/hydrus/settings.py
@@ -7,7 +7,7 @@ db_path = os.path.join(os.path.dirname(__file__), 'database.db')
 DB_URL = 'sqlite:///{}'.format(db_path)
 
 
-global HYDRUS_SERVER_URL, API_NAME, PORT
+global HYDRUS_SERVER_URL, PORT, API_NAME
 HYDRUS_SERVER_URL = "http://localhost:8080/"
 PORT = 8080
 API_NAME = "api"
diff --git a/main.py b/main.py
index f0007b8..9f72558 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,9 @@
 """Demo script for setting up Hydrus with any db and any API Doc."""
 
-from hydrus.app import app, set_session, set_doc
+from hydrus.app import app, set_session, set_doc, set_hydrus_server_url
 from hydrus.data import doc_parse
 from hydrus.hydraspec import doc_maker
+from hydrus.settings import HYDRUS_SERVER_URL
 from sqlalchemy import create_engine
 from sqlalchemy.orm import sessionmaker
 from hydrus.data.db_models import Base
@@ -35,7 +36,10 @@ doc_parse.insert_properties(properties, session)
 
 # Set the API Documentation
 with set_doc(app, apidoc):
-    # Set the DB session
-    with set_session(app, session):
+    # Set HYDRUS_SERVER_URL
+    with set_hydrus_server_url(app, HYDRUS_SERVER_URL):
+
+        # Set the DB session
+        with set_session(app, session):
         # Start Hydrus
-        app.run(host='127.0.0.1', debug=True, port=8080)
+            app.run(host='127.0.0.1', debug=True, port=8080)
diff --git a/setup.py b/setup.py
index 21daf73..28fec61 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,31 @@ setup(name='hydrus',
       author='W3C HYDRA development group',
       author_email='public-hydra@w3.org',
       url='https://github.com/HTTP-APIs/hydrus',
-      install_requires=['flask==0.11', 'thespian==3.5.2', 'lifter==0.4.1'],
+      install_requires=[
+      'Flask==0.11',
+      'Flask-RESTful==0.3.6',
+      'Jinja2==2.9.6',
+      'MarkupSafe==1.0',
+      'SQLAlchemy==1.1.10',
+      'Werkzeug==0.12.2',
+      'aniso8601==1.2.1',
+      'appdirs==1.4.3',
+      'argparse==1.2.1',
+      'click==6.7',
+      'itsdangerous==0.24',
+      'lifter==0.4.1',
+      'packaging==16.8',
+      'persisting-theory==0.2.1',
+      'psycopg2',
+      'pyparsing==2.2.0',
+      'python-dateutil==2.6.0',
+      'pytz==2017.2',
+      'six==1.10.0',
+      'thespian==3.5.2',
+      'flask-cors',
+      'blinker==1.4',
+
+      ],
       packages=[
         'hydrus',
       ],


Test patch:
diff --git a/hydrus/tests/test_app.py b/hydrus/tests/test_app.py
index 8da557e..6eb2126 100644
--- a/hydrus/tests/test_app.py
+++ b/hydrus/tests/test_app.py
@@ -7,7 +7,7 @@ import string
 import os
 import json
 import pdb
-from hydrus.app import API_NAME, SERVER_URL, API_DOC, app, set_session
+from hydrus.app import API_NAME, app, set_session, get_hydrus_server_url, get_doc
 from hydrus.data import doc_parse
 from hydrus.metadata.doc_gen import doc_gen
 from sqlalchemy import create_engine
@@ -94,7 +94,7 @@ class ViewsTestCase(unittest.TestCase):
                 assert "@context" in response_get_data
                 # print(response_get_data["@id"], SERVER_URL+API_NAME +"/vocab#")
                 assert response_get_data["@type"] == "ApiDocumentation"
-                assert response_get_data["@id"] == SERVER_URL+API_NAME+"/vocab"
+                assert response_get_data["@id"] == get_hydrus_server_url()+API_NAME+"/vocab"
                 assert response_get.status_code == 200
 
                 response_delete = client.delete("/"+API_NAME+"/vocab#")
@@ -114,7 +114,7 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for endpoint in endpoints:
-                    if endpoint in API_DOC.collections:
+                    if endpoint in get_doc().collections:
                         response_get = client.get(endpoints[endpoint])
                         assert response_get.status_code == 200
                         response_get_data = json.loads(response_get.data.decode('utf-8'))
@@ -131,9 +131,9 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
-                        collection = API_DOC.collections[collection_name]["collection"]
-                        dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                    if collection_name in get_doc().collections:
+                        collection = get_doc().collections[collection_name]["collection"]
+                        dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                         good_response_put = client.put(endpoints[collection_name], data=json.dumps(dummy_object))
                         assert good_response_put.status_code == 201
 
@@ -145,17 +145,17 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
-                        collection = API_DOC.collections[collection_name]["collection"]
-                        class_ = API_DOC.parsed_classes[collection.class_.title]["class"]
+                    if collection_name in get_doc().collections:
+                        collection = get_doc().collections[collection_name]["collection"]
+                        class_ = get_doc().parsed_classes[collection.class_.title]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
-                        dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                        dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                         initial_put_response = client.put(endpoints[collection_name], data=json.dumps(dummy_object))
                         assert initial_put_response.status_code == 201
                         response = json.loads(initial_put_response.data.decode('utf-8'))
                         id_ = response["201"].split('=')[1]
                         if "POST" in class_methods:
-                            dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                            dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                             post_replace_response = client.post(endpoints[collection_name]+'/'+str(id_), data=json.dumps(dummy_object))
                             assert post_replace_response.status_code == 200
 
@@ -167,11 +167,11 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
-                        collection = API_DOC.collections[collection_name]["collection"]
-                        class_ = API_DOC.parsed_classes[collection.class_.title]["class"]
+                    if collection_name in get_doc().collections:
+                        collection = get_doc().collections[collection_name]["collection"]
+                        class_ = get_doc().parsed_classes[collection.class_.title]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
-                        dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                        dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                         initial_put_response = client.put(endpoints[collection_name], data=json.dumps(dummy_object))
                         assert initial_put_response.status_code == 201
                         response = json.loads(initial_put_response.data.decode('utf-8'))
@@ -188,7 +188,7 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
+                    if collection_name in get_doc().collections:
                         response_get = client.get(endpoints[collection_name])
                         assert response_get.status_code == 200
                         context = json.loads(response_get.data.decode('utf-8'))["@context"]
@@ -205,13 +205,13 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
-                        collection = API_DOC.collections[collection_name]["collection"]
-                        class_ = API_DOC.parsed_classes[collection.class_.title]["class"]
+                    if collection_name in get_doc().collections:
+                        collection = get_doc().collections[collection_name]["collection"]
+                        class_ = get_doc().parsed_classes[collection.class_.title]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
-                        dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                        dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                         if "PUT" in class_methods:
-                            dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                            dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                             put_response = client.put(endpoints[collection_name], data=json.dumps(dummy_object))
                             assert put_response.status_code == 201
 
@@ -223,11 +223,11 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for class_name in endpoints:
-                    if class_name not in API_DOC.collections and class_name not in ["@context", "@id", "@type"]:
-                        class_ = API_DOC.parsed_classes[class_name]["class"]
+                    if class_name not in get_doc().collections and class_name not in ["@context", "@id", "@type"]:
+                        class_ = get_doc().parsed_classes[class_name]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
                         if "PUT" in class_methods:
-                            dummy_object = gen_dummy_object(class_.title, API_DOC)
+                            dummy_object = gen_dummy_object(class_.title, get_doc())
                             put_response = client.put(endpoints[class_name], data=json.dumps(dummy_object))
                             assert put_response.status_code == 201
 
@@ -239,11 +239,11 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for class_name in endpoints:
-                    if class_name not in API_DOC.collections and class_name not in ["@context", "@id", "@type"]:
-                        class_ = API_DOC.parsed_classes[class_name]["class"]
+                    if class_name not in get_doc().collections and class_name not in ["@context", "@id", "@type"]:
+                        class_ = get_doc().parsed_classes[class_name]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
                         if "POST" in class_methods:
-                            dummy_object = gen_dummy_object(class_.title, API_DOC)
+                            dummy_object = gen_dummy_object(class_.title, get_doc())
                             put_response = client.post(endpoints[class_name], data=json.dumps(dummy_object))
                             assert put_response.status_code == 201
 
@@ -255,8 +255,8 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for class_name in endpoints:
-                    if class_name not in API_DOC.collections and class_name not in ["@context", "@id", "@type"]:
-                        class_ = API_DOC.parsed_classes[class_name]["class"]
+                    if class_name not in get_doc().collections and class_name not in ["@context", "@id", "@type"]:
+                        class_ = get_doc().parsed_classes[class_name]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
                         if "DELETE" in class_methods:
                             put_response = client.delete(endpoints[class_name])
@@ -270,8 +270,8 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for class_name in endpoints:
-                    if class_name not in API_DOC.collections and class_name not in ["@context", "@id", "@type"]:
-                        class_ = API_DOC.parsed_classes[class_name]["class"]
+                    if class_name not in get_doc().collections and class_name not in ["@context", "@id", "@type"]:
+                        class_ = get_doc().parsed_classes[class_name]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
                         if "GET" in class_methods:
                             response_get = client.get(endpoints[class_name])
@@ -290,7 +290,7 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
+                    if collection_name in get_doc().collections:
                         bad_response_put = client.put(endpoints[collection_name], data=json.dumps(dict(foo='bar')))
                         assert bad_response_put.status_code == 400
 
@@ -302,17 +302,17 @@ class ViewsTestCase(unittest.TestCase):
                 assert index.status_code == 200
                 endpoints = json.loads(index.data.decode('utf-8'))
                 for collection_name in endpoints:
-                    if collection_name in API_DOC.collections:
-                        collection = API_DOC.collections[collection_name]["collection"]
-                        class_ = API_DOC.parsed_classes[collection.class_.title]["class"]
+                    if collection_name in get_doc().collections:
+                        collection = get_doc().collections[collection_name]["collection"]
+                        class_ = get_doc().parsed_classes[collection.class_.title]["class"]
                         class_methods = [x.method for x in class_.supportedOperation]
-                        dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                        dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                         initial_put_response = client.put(endpoints[collection_name], data=json.dumps(dummy_object))
                         assert initial_put_response.status_code == 201
                         response = json.loads(initial_put_response.data.decode('utf-8'))
                         id_ = response["201"].split('=')[1]
                         if "POST" not in class_methods:
-                            dummy_object = gen_dummy_object(collection.class_.title, API_DOC)
+                            dummy_object = gen_dummy_object(collection.class_.title, get_doc())
                             post_replace_response = client.post(endpoints[collection_name]+'/'+str(id_), data=json.dumps(dummy_object))
                             assert post_replace_response.status_code == 405