blob: a4f06fd035992e24d43b742e8b37aa85c7747ced [file] [log] [blame]
<!DOCTYPE html>
<html lang="en" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Hugo 0.54.0" />
<meta name="description" content="A set of micro-services for connecting millions of devices.">
<meta name="author" content="The Eclipse Hono Project">
<link rel="apple-touch-icon" sizes="180x180" href="/hono/docs/latest/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="48x48" href="/hono/docs/latest/favicon/favicon-48x48.png">
<link rel="icon" type="image/png" sizes="32x32" href="/hono/docs/latest/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/hono/docs/latest/favicon/favicon-16x16.png">
<link rel="manifest" href="/hono/docs/latest/favicon/site.webmanifest">
<link rel="mask-icon" href="/hono/docs/latest/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/hono/docs/latest/favicon/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/hono/docs/latest/favicon/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>Device Registry :: Eclipse Hono&trade;</title>
<link href="/hono/docs/latest/css/nucleus.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/fontawesome-all.min.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/hybrid.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/featherlight.min.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/perfect-scrollbar.min.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/auto-complete.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/theme.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/hugo-theme.css?1563931404" rel="stylesheet">
<link href="/hono/docs/latest/css/theme-hono.css?1563931404" rel="stylesheet">
<script src="/hono/docs/latest/js/jquery-2.x.min.js?1563931404"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
:not(pre) > code + span.copy-to-clipboard {
display: none;
}
</style>
<link rel="stylesheet" href="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/stylesheets/vendor/cookieconsent/cookieconsent.min.css">
<link rel="stylesheet" href='/hono/docs/latest/css/hono.css'>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@EclipseHono">
<meta name="twitter:title" content="Device Registry :: Eclipse Hono&amp;trade;">
<meta name="twitter:image" content="https://www.eclipse.org/hono/docs/latest/images/twitter_image.png">
<meta name="twitter:description" content="A set of micro-services for connecting millions of devices.">
<meta property="og:title" content="Device Registry :: Eclipse Hono&amp;trade;" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.eclipse.org/hono/docs/latest/user-guide/device-registry//" />
<meta property="og:image" content="https://www.eclipse.org/hono/docs/latest/images/twitter_image.png" />
</head>
<body class="" data-url="/hono/docs/latest/user-guide/device-registry/">
<nav id="sidebar" class="">
<div id="header-wrapper">
<div id="header">
<a href="https://www.eclipse.org/hono/" target="_blank">
<img src="/hono/docs/latest/images/HONO-Logo_Bild-Wort_quer-w-310x120px.svg" alt="Hono logo" class="logo-img">
</a>
</div>
<div class="searchbox">
<label for="search-by"><i class="fas fa-search"></i></label>
<input data-search-input id="search-by" type="search" placeholder="Search...">
<span data-search-clear=""><i class="fas fa-times"></i></span>
</div>
<script type="text/javascript" src="/hono/docs/latest/js/lunr.min.js?1563931404"></script>
<script type="text/javascript" src="/hono/docs/latest/js/auto-complete.js?1563931404"></script>
<script type="text/javascript">
var baseurl = "https:\/\/www.eclipse.org\/hono\/docs\/latest\/";
</script>
<script type="text/javascript" src="/hono/docs/latest/js/search.js?1563931404"></script>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/hono/docs/latest/concepts/" title="Concepts" class="dd-item
">
<a href="/hono/docs/latest/concepts/">
<i class="far fa-lightbulb"></i> Concepts
</a>
<ul>
<li data-nav-id="/hono/docs/latest/concepts/device-identity/" title="Device Identity" class="dd-item ">
<a href="/hono/docs/latest/concepts/device-identity/">
Device Identity
</a>
</li>
<li data-nav-id="/hono/docs/latest/concepts/tenancy/" title="Multi-Tenancy" class="dd-item ">
<a href="/hono/docs/latest/concepts/tenancy/">
Multi-Tenancy
</a>
</li>
<li data-nav-id="/hono/docs/latest/concepts/device-notifications/" title="Device Notifications" class="dd-item ">
<a href="/hono/docs/latest/concepts/device-notifications/">
Device Notifications
</a>
</li>
<li data-nav-id="/hono/docs/latest/concepts/command-and-control/" title="Command &amp; Control" class="dd-item ">
<a href="/hono/docs/latest/concepts/command-and-control/">
Command &amp; Control
</a>
</li>
<li data-nav-id="/hono/docs/latest/concepts/resource-limits/" title="Resource limits" class="dd-item ">
<a href="/hono/docs/latest/concepts/resource-limits/">
Resource limits
</a>
</li>
<li data-nav-id="/hono/docs/latest/concepts/connection-events/" title="Connection Events" class="dd-item ">
<a href="/hono/docs/latest/concepts/connection-events/">
Connection Events
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/" title="User Guide" class="dd-item
parent
">
<a href="/hono/docs/latest/user-guide/">
<i class="fas fa-book-reader"></i> User Guide
</a>
<ul>
<li data-nav-id="/hono/docs/latest/user-guide/device-registry/" title="Device Registry" class="dd-item active">
<a href="/hono/docs/latest/user-guide/device-registry/">
Device Registry
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/http-adapter/" title="HTTP Adapter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/http-adapter/">
HTTP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/mqtt-adapter/" title="MQTT Adapter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/mqtt-adapter/">
MQTT Adapter
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/amqp-adapter/" title="AMQP Adapter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/amqp-adapter/">
AMQP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/kura-adapter/" title="Kura Adapter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/kura-adapter/">
Kura Adapter
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/sigfox-adapter/" title="Sigfox Adapter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/sigfox-adapter/">
Sigfox Adapter
</a>
</li>
<li data-nav-id="/hono/docs/latest/user-guide/jmeter_load_tests/" title="Load Tests with JMeter" class="dd-item ">
<a href="/hono/docs/latest/user-guide/jmeter_load_tests/">
Load Tests with JMeter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/" title="Admin Guide" class="dd-item
">
<a href="/hono/docs/latest/admin-guide/">
<i class="fas fa-sliders-h"></i> Admin Guide
</a>
<ul>
<li data-nav-id="/hono/docs/latest/admin-guide/common-config/" title="Common Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/common-config/">
Common Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/auth-server-config/" title="Auth Server Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/auth-server-config/">
Auth Server Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/device-registry-config/" title="Device Registry Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/device-registry-config/">
Device Registry Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/http-adapter-config/" title="HTTP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/http-adapter-config/">
HTTP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/amqp-adapter-config/" title="AMQP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/amqp-adapter-config/">
AMQP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/mqtt-adapter-config/" title="MQTT Adapter Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/mqtt-adapter-config/">
MQTT Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/kura-adapter-config/" title="Kura Adapter Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/kura-adapter-config/">
Kura Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/hono-client-configuration/" title="Hono Client Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/hono-client-configuration/">
Hono Client Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/amqp-network-config/" title="AMQP 1.0 Messaging Network Configuration" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/amqp-network-config/">
AMQP 1.0 Messaging Network Configuration
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/secure_communication/" title="Secure Communication" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/secure_communication/">
Secure Communication
</a>
</li>
<li data-nav-id="/hono/docs/latest/admin-guide/monitoring-tracing-config/" title="Monitoring &amp; Tracing" class="dd-item ">
<a href="/hono/docs/latest/admin-guide/monitoring-tracing-config/">
Monitoring &amp; Tracing
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/dev-guide/" title="Developer Guide" class="dd-item
">
<a href="/hono/docs/latest/dev-guide/">
<i class="fas fa-tools"></i> Developer Guide
</a>
<ul>
<li data-nav-id="/hono/docs/latest/dev-guide/building_hono/" title="Building from Source" class="dd-item ">
<a href="/hono/docs/latest/dev-guide/building_hono/">
Building from Source
</a>
</li>
<li data-nav-id="/hono/docs/latest/dev-guide/java_client_consumer/" title="Consuming Messages from Java" class="dd-item ">
<a href="/hono/docs/latest/dev-guide/java_client_consumer/">
Consuming Messages from Java
</a>
</li>
<li data-nav-id="/hono/docs/latest/dev-guide/custom_http_adapter/" title="Implement a Custom Hono HTTP Protocol Adapter" class="dd-item ">
<a href="/hono/docs/latest/dev-guide/custom_http_adapter/">
Implement a Custom Hono HTTP Protocol Adapter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/api/" title="API" class="dd-item
">
<a href="/hono/docs/latest/api/">
&nbsp;<i class='fas fa-plug'></i>&nbsp;API
</a>
<ul>
<li data-nav-id="/hono/docs/latest/api/telemetry-api/" title="Telemetry API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/telemetry-api/">
Telemetry API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/event-api/" title="Event API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/event-api/">
Event API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/command-and-control-api/" title="Command &amp; Control API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/command-and-control-api/">
Command &amp; Control API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/tenant-api/" title="Tenant API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/tenant-api/">
Tenant API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/device-connection-api/" title="Device Connection API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/device-connection-api/">
Device Connection API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/device-registration-api/" title="Device Registration API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/device-registration-api/">
Device Registration API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/credentials-api/" title="Credentials API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/credentials-api/">
Credentials API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/authentication-api/" title="Authentication API Specification" class="dd-item ">
<a href="/hono/docs/latest/api/authentication-api/">
Authentication API
</a>
</li>
<li data-nav-id="/hono/docs/latest/api/metrics/" title="Metrics" class="dd-item ">
<a href="/hono/docs/latest/api/metrics/">
Metrics
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/deployment/" title="Deployment" class="dd-item
">
<a href="/hono/docs/latest/deployment/">
<i class="fas fa-shipping-fast"></i> Deployment
</a>
<ul>
<li data-nav-id="/hono/docs/latest/deployment/helm-based-deployment/" title="Helm based Deployment" class="dd-item ">
<a href="/hono/docs/latest/deployment/helm-based-deployment/">
Helm based Deployment
</a>
</li>
<li data-nav-id="/hono/docs/latest/deployment/openshift/" title="OpenShift / OKD" class="dd-item ">
<a href="/hono/docs/latest/deployment/openshift/">
OpenShift / OKD
</a>
</li>
<li data-nav-id="/hono/docs/latest/deployment/create-kubernetes-cluster/" title="Setting up a Kubernetes Cluster" class="dd-item ">
<a href="/hono/docs/latest/deployment/create-kubernetes-cluster/">
Setting up a Kubernetes Cluster
</a>
</li>
<li data-nav-id="/hono/docs/latest/deployment/resource-limitation/" title="Limiting Resource Usage" class="dd-item ">
<a href="/hono/docs/latest/deployment/resource-limitation/">
Limiting Resource Usage
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/latest/architecture/" title="Architecture" class="dd-item
">
<a href="/hono/docs/latest/architecture/">
<i class="fas fa-landmark"></i> Architecture
</a>
<ul>
<li data-nav-id="/hono/docs/latest/architecture/component-view/component-view/" title="Component View" class="dd-item ">
<a href="/hono/docs/latest/architecture/component-view/component-view/">
Component View
</a>
</li>
<li data-nav-id="/hono/docs/latest/architecture/auth/auth/" title="Authentication/Authorization" class="dd-item ">
<a href="/hono/docs/latest/architecture/auth/auth/">
Authentication/Authorization
</a>
</li>
</ul>
</li>
</ul>
<section id="footer">
<p>&copy; 2019 <a href="https://www.eclipse.org/hono/" target="_blank">The Eclipse Hono Project</a></p>
<p>
Documentation built with
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
using the
<a href="https://github.com/matcornic/hugo-theme-learn" target="_blank">Learn</a> theme.
</p>
<div class="eclipse-logo">
<a href="https://www.eclipse.org" target="_blank">
<img src="https://www.eclipse.org/hono/docs/latest/images/eclipse_foundation_logo.svg"/>
</a>
</div>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="old-version-hint">
<p>This page refers to version <em>latest</em>.
You might want to change to the <a href="https://www.eclipse.org/hono/docs/stable">current stable</a> version.
</p>
</div>
<div class="padding highlightable">
<div>
<div id="top-bar">
<div id="top-github-link">
<a class="github-link" title='Edit this page' href="https://github.com/eclipse/hono/edit/master/site/documentation/content/user-guide/device-registry.md" target="blank">
<i class="fas fa-code-branch"></i>
<span id="top-github-link-text">Edit this page</span>
</a>
</div>
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fas fa-bars"></i>
</a>
</span>
<span id="toc-menu"><i class="fas fa-list-alt"></i></span>
<span class="links">
<a href='/hono/docs/latest/'>Documentation</a> > <a href='/hono/docs/latest/user-guide/'>User Guide</a> > Device Registry
</span>
</div>
<div class="progress">
<div class="wrapper">
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#managing-tenants">Managing Tenants</a>
<ul>
<li><a href="#add-a-tenant">Add a Tenant</a></li>
<li><a href="#get-configuration-details-of-a-tenant">Get configuration details of a Tenant</a></li>
<li><a href="#update-tenant">Update Tenant</a></li>
<li><a href="#delete-tenant">Delete Tenant</a></li>
</ul></li>
<li><a href="#managing-device-registration-information">Managing Device Registration Information</a>
<ul>
<li><a href="#register-device">Register Device</a></li>
<li><a href="#read-registration">Read Registration</a></li>
<li><a href="#update-registration">Update Registration</a></li>
<li><a href="#delete-registration">Delete Registration</a></li>
</ul></li>
<li><a href="#managing-credentials">Managing Credentials</a>
<ul>
<li><a href="#add-credentials-for-a-device">Add Credentials for a Device</a></li>
<li><a href="#get-credentials-by-authentication-identifier-and-type">Get Credentials by Authentication Identifier and Type</a></li>
<li><a href="#get-all-credentials-for-a-device">Get all Credentials for a Device</a></li>
<li><a href="#update-credentials">Update Credentials</a></li>
<li><a href="#delete-credentials-by-type-and-authentication-identifier">Delete Credentials by Type and Authentication Identifier</a></li>
<li><a href="#delete-all-credentials-of-a-device">Delete all Credentials of a Device</a></li>
</ul></li>
</ul></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="body-inner">
<h1>Device Registry</h1>
<p>The Device Registry component provides exemplary implementations of Hono&rsquo;s <a href="/hono/docs/latest/api/tenant-api/">Tenant API</a>, <a href="/hono/docs/latest/api/device-registration-api/">Device Registration API</a> and <a href="/hono/docs/latest/api/credentials-api/">Credentials API</a>.</p>
<p>As such it exposes AMQP 1.0 based endpoints for retrieving the relevant information and persists data in the local filesystem.</p>
<p>In addition, the Device Registry also exposes HTTP resources for managing the contents of the registry.</p>
<div class="alert alert-warning">
<h4 class="alert-heading"><i class="fas fa-exclamation-triangle"></i> Warning</h4>
<div><p>The Device Registry is not intended to be used in production environments. In particular, access to the HTTP resources described below is not restricted to authorized clients only.</p>
<p>The resources have been designed to provide convenient access to the registry&rsquo;s content using command line tools like <em>curl</em> or <em>HTTPie</em>.</p>
</div>
</div>
<p>Please note that the HTTP resources exposed by the Device Registry are <strong>not</strong> part of the <em>official</em> definition of the Device Registration, Credentials and Tenant APIs.</p>
<h2 id="managing-tenants">Managing Tenants</h2>
<p>The following sections describe the resources representing the operations of the Tenant API and how they can be used to manage tenants.
Please refer to the <a href="/hono/docs/latest/api/tenant-api/">Tenant API</a> for the specific elements that are explained in detail there.</p>
<h3 id="add-a-tenant">Add a Tenant</h3>
<ul>
<li>URI: <code>/tenant</code></li>
<li>Method: <code>POST</code></li>
<li>Request Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code> (no other type supported)</li>
</ul></li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/tenant-api/#request-payload">Request Payload</a> of the Tenant API. The object also needs to contain the tenant&rsquo;s identifier in the <code>tenant-id</code> property.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>201 (Created): Tenant has been added successfully under the resource indicated by <code>Location</code> header.</li>
<li>400 (Bad Request): The tenant has not been created because the request was malformed, e .g. because the payload was malformed. The response body may contain hints regarding the cause of the problem.</li>
<li>409 (Conflict): A tenant with the given <code>tenant-id</code> already exists. The request has not been processed.</li>
</ul></li>
<li>Response Headers:
<ul>
<li><code>Location</code>: The URI under which the newly created resource can be accessed.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following commands add some tenants with different adapter configurations:</p>
<p>Add a tenant that has all adapters set to enabled:</p>
<pre><code>curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;tenant-id&quot;: &quot;tenantAllAdapters&quot;
}' http://localhost:28080/tenant
HTTP/1.1 201 Created
Location: /tenant/tenantAllAdapters
Content-Length: 0
</code></pre>
<p>Add a tenant that can only use the MQTT adapter:</p>
<pre><code>curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;tenant-id&quot;: &quot;tenantMqttAdapter&quot;,
&quot;adapters&quot; : [ {
&quot;type&quot; : &quot;hono-mqtt&quot;,
&quot;enabled&quot; : true
} ]
}' http://localhost:28080/tenant
HTTP/1.1 201 Created
Location: /tenant/tenantMqttAdapter
Content-Length: 0
</code></pre>
<h3 id="get-configuration-details-of-a-tenant">Get configuration details of a Tenant</h3>
<ul>
<li>URI: <code>/tenant/${tenantId}</code></li>
<li>Method: <code>GET</code></li>
<li>Status Codes:
<ul>
<li>200 (OK): A tenant with the given identifier has been found. The response body contains the tenant data as specified by <a href="/hono/docs/latest/api/tenant-api/#response-payload">Response Payload</a> of the Tenant API.</li>
<li>404 (Not Found): No tenant with the given identifier is registered.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following command retrieves the details for the tenant <code>tenantMqttAdapter</code>:</p>
<pre><code>curl -i http://localhost:28080/tenant/tenantMqttAdapter
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 172
{
&quot;tenant-id&quot; : &quot;tenantMqttAdapter&quot;,
&quot;enabled&quot; : true,
&quot;adapters&quot; : [ {
&quot;type&quot; : &quot;hono-mqtt&quot;,
&quot;enabled&quot; : true
} ]
}
</code></pre>
<h3 id="update-tenant">Update Tenant</h3>
<ul>
<li>URI: <code>/tenant/${tenantId}</code></li>
<li>Method: <code>PUT</code></li>
<li>Request Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code> (no other type supported)</li>
</ul></li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/tenant-api/#request-payload">Request Payload</a> of the Tenant API.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>204 (No Content): The tenant has been updated successfully.</li>
<li>400 (Bad Request): The tenant has not been updated because the request was malformed, e .g. because the payload was malformed. The response body may contain hints regarding the cause of the problem.</li>
<li>404 (Not Found): The request could not be processed because no tenant with the given identifier exists.</li>
</ul></li>
</ul>
<p>This resource can be used to change the configuration of a particular tenant.</p>
<p><strong>Example</strong></p>
<p>The following command disables the MQTT adapter for devices that belong to the tenant <code>tenantMqttAdapter</code>:</p>
<pre><code>curl -i -X PUT -H 'Content-Type: application/json' --data-binary '{
&quot;adapters&quot; : [ {
&quot;type&quot; : &quot;hono-mqtt&quot;,
&quot;enabled&quot; : true
} ]
}' http://localhost:28080/tenant/tenantMqttAdapter
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h3 id="delete-tenant">Delete Tenant</h3>
<ul>
<li>URI: <code>/tenant/${tenantId}</code></li>
<li>Method: <code>DELETE</code></li>
<li>Status Codes:
<ul>
<li>204 (No Content): The tenant with the given identifier has been deleted.</li>
<li>404 (Not Found): The request could not be processed because no tenant with the given identifier exists.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<pre><code>curl -i -X DELETE http://localhost:28080/tenant/tenantMqttAdapter
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h2 id="managing-device-registration-information">Managing Device Registration Information</h2>
<p>The following sections describe the resources representing the operations of the <a href="/hono/docs/latest/api/device-registration-api/">Device Registration API</a> and how they can be used to manage device registration information.</p>
<h3 id="register-device">Register Device</h3>
<ul>
<li>URI: <code>/registration/${tenantId}</code></li>
<li>Method: <code>POST</code></li>
<li>Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code></li>
</ul></li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/device-registration-api/#request-payload">Request Payload</a> of the Device Registration API. The object also needs to contain the device&rsquo;s identifier in the <code>device-id</code> property.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>201 (Created): Device has been registered successfully under resource indicated by <code>Location</code> header.</li>
<li>400 (Bad Request): Device has not been registered because the request was malformed, e .g. a required header is missing (the body may contain hints regarding the problem).</li>
<li>409 (Conflict): There already exists a device with the given ID. The request has not been processed.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following command registers a device with ID <code>4711</code></p>
<pre><code>curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;device-id&quot;: &quot;4711&quot;,
&quot;ep&quot;: &quot;IMEI4711&quot;
}' http://localhost:28080/registration/DEFAULT_TENANT
</code></pre>
<p>The response will contain a <code>Location</code> header containing the resource path created for the device. In this example it will look
like this:</p>
<pre><code>HTTP/1.1 201 Created
Location: /registration/DEFAULT_TENANT/4711
Content-Length: 0
</code></pre>
<h3 id="read-registration">Read Registration</h3>
<ul>
<li>URI: <code>/registration/${tenantId}/${deviceId}</code></li>
<li>Method: <code>GET</code></li>
<li>Status Codes:
<ul>
<li>200 (OK): A device with the given identifier has been found. The response body contains the registration information as specified by <a href="/hono/docs/latest/api/device-registration-api/#response-payload">Response Payload</a> of the Device Registration API.</li>
<li>404 (Not Found): No device with the given identifier is registered for the given tenant.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following command retrieves registration data for device <code>4711</code>:</p>
<pre><code>curl -i http://localhost:28080/registration/DEFAULT_TENANT/4711
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 35
{
&quot;data&quot; : {
&quot;enabled&quot;: true,
&quot;ep&quot;: &quot;IMEI4711&quot;
},
&quot;device-id&quot; : &quot;4711&quot;
}
</code></pre>
<h3 id="update-registration">Update Registration</h3>
<ul>
<li>URI: <code>/registration/${tenantId}/${deviceId}</code></li>
<li>Method: <code>PUT</code></li>
<li>Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code></li>
</ul></li>
<li>Parameters (encoded as a JSON object in the request body):</li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/device-registration-api/#request-payload">Request Payload</a> of the Device Registration API. All existing registration information will be replaced by the data provided in the object.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>204 (No Content): Device registration data has been updated.</li>
<li>400 (Bad Request): Device registration has not been updated because the request was malformed, e .g. a required header is missing (the body may contain hints regarding the problem).</li>
<li>404 (Not Found): No device with the given identifier is registered for the given tenant.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<pre><code>curl -i -X PUT -H 'Content-Type: application/json' --data-binary '{
&quot;ep&quot;: &quot;IMEI4711&quot;,
&quot;psk-id&quot;: &quot;psk4711&quot;
}' http://localhost:28080/registration/DEFAULT_TENANT/4711
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h3 id="delete-registration">Delete Registration</h3>
<ul>
<li>URI: <code>/registration/${tenantId}/${deviceId}</code></li>
<li>Method: <code>DELETE</code></li>
<li>Status Codes:
<ul>
<li>204 (No Content): Device registration has been deleted.</li>
<li>404 (Not Found): No device with the given identifier is registered for the given tenant.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<pre><code>curl -i -X DELETE http://localhost:28080/registration/DEFAULT_TENANT/4711
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h2 id="managing-credentials">Managing Credentials</h2>
<p>The following sections describe the resources representing the operations of the Credentials API and how they can be used to manage credentials for devices.
Please refer to the <a href="/hono/docs/latest/api/credentials-api/">Credentials API</a> for the specific elements that are explained in detail there.</p>
<h3 id="add-credentials-for-a-device">Add Credentials for a Device</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}</code></li>
<li>Method: <code>POST</code></li>
<li>Request Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code> (no other type supported)</li>
</ul></li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/credentials-api/#credentials-format">Credentials Format</a> of the Credentials API.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>201 (Created): Credentials have been added successfully under the resource indicated by <code>Location</code> header.</li>
<li>400 (Bad Request): The credentials have not been added because the request was malformed, e .g. because the payload did not contain required values. The response body may contain hints regarding the cause of the problem.</li>
<li>409 (Conflict): Credentials of the given type for the given <em>auth-id</em> already exist for the tenant. The request has not been processed.</li>
</ul></li>
<li>Response Headers:
<ul>
<li><code>Location</code>: The URI under which the newly created resource can be accessed.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following command adds some <code>hashed-password</code> credentials from a given plain text password for device <code>4710</code> using authentication identifier <code>sensor10</code>:</p>
<pre><code>curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;device-id&quot;: &quot;4710&quot;,
&quot;type&quot;: &quot;hashed-password&quot;,
&quot;auth-id&quot;: &quot;sensor10&quot;,
&quot;secrets&quot;: [{
&quot;pwd-plain&quot;: &quot;mylittlesecret&quot;
}]
}' http://localhost:28080/credentials/DEFAULT_TENANT
HTTP/1.1 201 Created
Location: /credentials/DEFAULT_TENANT/sensor10/hashed-password
Content-Length: 0
</code></pre>
<p>This uses a convenient option which lets the Device Registry do the hashing of the password. The following command retrieves the credentials that are stored by the Device Registry as a result of the command above:</p>
<pre><code>curl -i http://localhost:28080/credentials/DEFAULT_TENANT/4710
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 222
{
&quot;total&quot;: 1,
&quot;credentials&quot;: [
{
&quot;device-id&quot;: &quot;4710&quot;,
&quot;type&quot;: &quot;hashed-password&quot;,
&quot;auth-id&quot;: &quot;sensor10&quot;,
&quot;enabled&quot;: true,
&quot;secrets&quot;: [
{
&quot;pwd-hash&quot;: &quot;$2a$10$uc.qVDwXeDRE1DWa1sM9iOaY9wuevjfALGMtXmHKP.SJDEqg0q7M6&quot;,
&quot;hash-function&quot;: &quot;bcrypt&quot;
}
]
}
]
}
</code></pre>
<p>The following commands add some <code>hashed-password</code> credentials for device <code>4720</code> using authentication identifier <code>sensor20</code>:</p>
<pre><code>PWD_HASH=$(echo -n &quot;mylittlesecret&quot; | openssl dgst -binary -sha512 | base64 -w 0)
curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;device-id&quot;: &quot;4720&quot;,
&quot;type&quot;: &quot;hashed-password&quot;,
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;secrets&quot;: [{
&quot;hash-function&quot; : &quot;sha-512&quot;,
&quot;pwd-hash&quot;: &quot;'$PWD_HASH'&quot;
}]
}' http://localhost:28080/credentials/DEFAULT_TENANT
HTTP/1.1 201 Created
Location: /credentials/DEFAULT_TENANT/sensor20/hashed-password
Content-Length: 0
</code></pre>
<p>Multiple credentials of different type can be registered for the same authentication identifier.
The following commands add <code>psk</code> credentials for the same device <code>4720</code> using authentication identifier <code>sensor20</code>:</p>
<pre><code>SHARED_KEY=$(echo -n &quot;TheSharedKey&quot; | base64 -w 0)
curl -i -X POST -H 'Content-Type: application/json' --data-binary '{
&quot;device-id&quot;: &quot;4720&quot;,
&quot;type&quot;: &quot;psk&quot;,
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;secrets&quot;: [{
&quot;key&quot; : &quot;'$SHARED_KEY'&quot;
}]
}' http://localhost:28080/credentials/DEFAULT_TENANT
HTTP/1.1 201 Created
Location: /credentials/DEFAULT_TENANT/sensor20/psk
Content-Length: 0
</code></pre>
<h3 id="get-credentials-by-authentication-identifier-and-type">Get Credentials by Authentication Identifier and Type</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}/${authId}/${type}</code></li>
<li>Method: <code>GET</code></li>
<li>Status Codes:
<ul>
<li>200 (OK): Credentials for the given parameters have been found. The response body will contain credentials as specified by <a href="/hono/docs/latest/api/credentials-api/#credentials-format">Credentials Format</a> of the Credentials API.</li>
<li>404 (Not Found): No credentials for the given parameters are registered for the given tenant.</li>
</ul></li>
</ul>
<p>The <a href="/hono/docs/latest/api/credentials-api/#get-credentials">Get Credentials</a> operation of Credentials API defines that arbitrary array of properties can be passed to help identify the device.
It&rsquo;s not specified if and how these properties can be used by the implementation. The Device Registry will try to match the
properties against the properties defined in the credentials record. It will return the credentials only if all the properties in the request are successfully matched.</p>
<p><strong>Example</strong></p>
<p>The following command retrieves credentials data of type <code>hashed-password</code> for the authentication identifier <code>sensor20</code>:</p>
<pre><code>curl -i http://localhost:28080/credentials/DEFAULT_TENANT/sensor20/hashed-password
HTTP/1.1 200 OK
Content-Length: 268
Content-Type: application/json; charset=utf-8
{
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;device-id&quot;: &quot;4720&quot;,
&quot;enabled&quot;: true,
&quot;secrets&quot;: [
{
&quot;hash-function&quot;: &quot;sha-512&quot;,
&quot;pwd-hash&quot;: &quot;tnxz0zDFs+pJGdCVSuoPE4TnamXsfIjBEOb0rg3e9WFD9KfbCkoRuwVZKgRWInfqp87kCLsoV/HEwdJwgw793Q==&quot;
}
],
&quot;type&quot;: &quot;hashed-password&quot;
}
</code></pre>
<h3 id="get-all-credentials-for-a-device">Get all Credentials for a Device</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}/${deviceId}</code></li>
<li>Method: <code>GET</code></li>
<li>Status Codes:
<ul>
<li>200 (OK): Credentials for the device have been found, body contains the credentials.
The body differs from the body for a specific type since it may contain an arbitrary number of credentials. It contains a property <code>total</code> indicating the total number of credentials returned. The credentials are contained in property <code>credentials</code>.</li>
<li>404 (Not Found): No credentials for the device are registered.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<p>The following command retrieves credentials for device <code>4720</code>:</p>
<pre><code>curl -i http://localhost:28080/credentials/DEFAULT_TENANT/4720
HTTP/1.1 200 OK
Content-Length: 491
Content-Type: application/json; charset=utf-8
{
&quot;credentials&quot;: [
{
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;device-id&quot;: &quot;4720&quot;,
&quot;enabled&quot;: true,
&quot;secrets&quot;: [
{
&quot;hash-function&quot;: &quot;sha-512&quot;,
&quot;pwd-hash&quot;: &quot;tnxz0zDFs+pJGdCVSuoPE4TnamXsfIjBEOb0rg3e9WFD9KfbCkoRuwVZKgRWInfqp87kCLsoV/HEwdJwgw793Q==&quot;
}
],
&quot;type&quot;: &quot;hashed-password&quot;
},
{
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;device-id&quot;: &quot;4720&quot;,
&quot;enabled&quot;: true,
&quot;secrets&quot;: [
{
&quot;key&quot;: &quot;VGhlU2hhcmVkS2V5&quot;
}
],
&quot;type&quot;: &quot;psk&quot;
}
],
&quot;total&quot;: 2
}
</code></pre>
<h3 id="update-credentials">Update Credentials</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}/${authId}/${type}</code></li>
<li>Method: <code>PUT</code></li>
<li>Request Headers:
<ul>
<li>(required) <code>Content-Type</code>: <code>application/json</code> (no other type supported)</li>
</ul></li>
<li>Request Body:
<ul>
<li>(required) A JSON object as specified by <a href="/hono/docs/latest/api/credentials-api/#credentials-format">Credentials Format</a> of the Credentials API.</li>
</ul></li>
<li>Status Codes:
<ul>
<li>204 (No Content): The credentials have been updated successfully.</li>
<li>400 (Bad Request): The credentials have not been updated because the request was malformed, e .g. because the payload did not contain required values or the type and auth-id in the payload do not match the path parameters. The response body may contain hints regarding the cause of the problem.</li>
<li>404 (Not Found): The request could not be processed because there exist no credentials of the given type and authentication identifier.</li>
</ul></li>
</ul>
<p>This resource can be used to change values of a particular set of credentials. However, it cannot be used to change the type or authentication identifier of the credentials.</p>
<p><strong>Example</strong></p>
<p>The following command adds an expiration date to the <code>hashed-password</code> credentials for authentication identifier <code>sensor20</code>:</p>
<pre><code>PWD_HASH=$(echo -n &quot;mylittlesecret&quot; | openssl dgst -binary -sha512 | base64 -w 0)
curl -i -X PUT -H 'Content-Type: application/json' --data-binary '{
&quot;device-id&quot;: &quot;4720&quot;,
&quot;type&quot;: &quot;hashed-password&quot;,
&quot;auth-id&quot;: &quot;sensor20&quot;,
&quot;secrets&quot;: [{
&quot;hash-function&quot; : &quot;sha-512&quot;,
&quot;pwd-hash&quot;: &quot;'$PWD_HASH'&quot;,
&quot;not-after&quot;: &quot;2018-01-01T00:00:00+01:00&quot;
}]
}' http://localhost:28080/credentials/DEFAULT_TENANT/sensor20/hashed-password
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h3 id="delete-credentials-by-type-and-authentication-identifier">Delete Credentials by Type and Authentication Identifier</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}/${authId}/${type}</code></li>
<li>Method: <code>DELETE</code></li>
<li>Status Codes:
<ul>
<li>204 (No Content): The Credentials with the given identifier and type have been deleted.</li>
<li>404 (Not Found): No credentials matching the criteria have been found.</li>
</ul></li>
</ul>
<p><strong>Example</strong></p>
<pre><code>curl -i -X DELETE http://localhost:28080/credentials/DEFAULT_TENANT/sensor20/hashed-password
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<h3 id="delete-all-credentials-of-a-device">Delete all Credentials of a Device</h3>
<ul>
<li>URI: <code>/credentials/${tenantId}/${deviceId}</code></li>
<li>Method: <code>DELETE</code></li>
<li>Status Codes:
<ul>
<li>204 (No Content): All Credentials for the device have been deleted. There is no payload in the response.</li>
<li>404 (Not Found): No credentials have been found for the device and the given tenant.</li>
</ul></li>
</ul>
<p>Removes all credentials registered for a particular device.</p>
<p><strong>Example</strong></p>
<pre><code>curl -i -X DELETE http://localhost:28080/credentials/DEFAULT_TENANT/4720
HTTP/1.1 204 No Content
Content-Length: 0
</code></pre>
<footer class=" footline" >
</footer>
</div>
</div>
<div id="navigation">
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="/hono/docs/latest/js/clipboard.min.js?1563931404"></script>
<script src="/hono/docs/latest/js/perfect-scrollbar.min.js?1563931404"></script>
<script src="/hono/docs/latest/js/perfect-scrollbar.jquery.min.js?1563931404"></script>
<script src="/hono/docs/latest/js/jquery.sticky.js?1563931404"></script>
<script src="/hono/docs/latest/js/featherlight.min.js?1563931404"></script>
<script src="/hono/docs/latest/js/html5shiv-printshiv.min.js?1563931404"></script>
<script src="/hono/docs/latest/js/highlight.pack.js?1563931404"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/hono/docs/latest/js/modernizr.custom.71422.js?1563931404"></script>
<script src="/hono/docs/latest/js/learn.js?1563931404"></script>
<script src="/hono/docs/latest/js/hugo-learn.js?1563931404"></script>
<link href="/hono/docs/latest/mermaid/mermaid.css?1563931404" type="text/css" rel="stylesheet" />
<script src="/hono/docs/latest/mermaid/mermaid.js?1563931404"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5WLCZXC');
</script>
<script src="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/vendor/cookieconsent/default.min.js"></script>
</body>
</html>