diff --git a/xos/api/service/exampleservice.py b/xos/api/service/exampleservice.py
new file mode 100644
index 0000000..d8fe23a
--- /dev/null
+++ b/xos/api/service/exampleservice.py
@@ -0,0 +1,54 @@
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+from rest_framework.reverse import reverse
+from rest_framework import serializers
+from rest_framework import generics
+from rest_framework import viewsets
+from rest_framework import status
+from rest_framework.decorators import detail_route, list_route
+from rest_framework.views import APIView
+from core.models import *
+from django.forms import widgets
+from django.conf.urls import patterns, url
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+from django.shortcuts import get_object_or_404
+from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
+from xos.exceptions import *
+import json
+import subprocess
+from services.exampleservice.models import ExampleService
+
+class ExampleServiceSerializer(PlusModelSerializer):
+        id = ReadOnlyField()
+        humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+        service_message = serializers.CharField(required=False)
+
+        class Meta:
+            model = ExampleService
+            fields = ('humanReadableName',
+                      'id',
+                      'service_message')
+
+        def getHumanReadableName(self, obj):
+            return obj.__unicode__()
+
+class ExampleServiceViewSet(XOSViewSet):
+    base_name = "exampleservice"
+    method_name = "exampleservice"
+    method_kind = "viewset"
+    queryset = ExampleService.get_service_objects().all()
+    serializer_class = ExampleServiceSerializer
+
+    @classmethod
+    def get_urlpatterns(self, api_path="^"):
+        patterns = super(ExampleServiceViewSet, self).get_urlpatterns(api_path=api_path)
+
+        return patterns
+
+    def list(self, request):
+        object_list = self.filter_queryset(self.get_queryset())
+
+        serializer = self.get_serializer(object_list, many=True)
+
+        return Response(serializer.data)
+
diff --git a/xos/api/tenant/exampletenant.py b/xos/api/tenant/exampletenant.py
new file mode 100644
index 0000000..f4778cc
--- /dev/null
+++ b/xos/api/tenant/exampletenant.py
@@ -0,0 +1,67 @@
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+from rest_framework.reverse import reverse
+from rest_framework import serializers
+from rest_framework import generics
+from rest_framework import status
+from core.models import *
+from django.forms import widgets
+from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+
+from services.exampleservice.models import ExampleTenant, ExampleService
+
+def get_default_example_service():
+    example_services = ExampleService.get_service_objects().all()
+    if example_services:
+        return example_services[0]
+    return None
+
+class ExampleTenantSerializer(PlusModelSerializer):
+        id = ReadOnlyField()
+        provider_service = serializers.PrimaryKeyRelatedField(queryset=ExampleService.get_service_objects().all(), default=get_default_example_service)
+        tenant_message = serializers.CharField(required=False)
+        backend_status = ReadOnlyField()
+
+        humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+
+        class Meta:
+            model = ExampleTenant
+            fields = ('humanReadableName', 'id', 'provider_service', 'tenant_message', 'backend_status')
+
+        def getHumanReadableName(self, obj):
+            return obj.__unicode__()
+
+class ExampleTenantViewSet(XOSViewSet):
+    base_name = "exampletenant"
+    method_name = "exampletenant"
+    method_kind = "viewset"
+    queryset = ExampleTenant.get_tenant_objects().all()
+    serializer_class = ExampleTenantSerializer
+
+    @classmethod
+    def get_urlpatterns(self, api_path="^"):
+        patterns = super(ExampleTenantViewSet, self).get_urlpatterns(api_path=api_path)
+
+        # example to demonstrate adding a custom endpoint
+        patterns.append( self.detail_url("message/$", {"get": "get_message", "put": "set_message"}, "message") )
+
+        return patterns
+
+    def list(self, request):
+        queryset = self.filter_queryset(self.get_queryset())
+
+        serializer = self.get_serializer(queryset, many=True)
+
+        return Response(serializer.data)
+
+    def get_message(self, request, pk=None):
+        example_tenant = self.get_object()
+        return Response({"tenant_message": example_tenant.tenant_message})
+
+    def set_message(self, request, pk=None):
+        example_tenant = self.get_object()
+        example_tenant.tenant_message = request.data["tenant_message"]
+        example_tenant.save()
+        return Response({"tenant_message": example_tenant.tenant_message})
+
