|
| 1 | +//// |
| 2 | +Copyright (c) 2025 Industrial Digital Twin Association |
| 3 | + |
| 4 | +This work is licensed under a [Creative Commons Attribution 4.0 International License]( |
| 5 | +https://creativecommons.org/licenses/by/4.0/). |
| 6 | + |
| 7 | +SPDX-License-Identifier: CC-BY-4.0 |
| 8 | + |
| 9 | +//// |
| 10 | + |
| 11 | += Examples of ROUTEs and HTTP requests |
| 12 | + |
| 13 | +This annex is informative. |
| 14 | +It gives concrete examples for RIGHTS and ROUTE objects using AAS Part 2 HTTP/REST path templates. |
| 15 | + |
| 16 | +Unless stated otherwise, the examples use the server base URL `https://admin-shell.io/api/v3/` as published in the AAS Part 2 OpenAPI descriptions. |
| 17 | +Only the URL path is relevant for ROUTE matching. |
| 18 | + |
| 19 | +== Rights, operation verbs and HTTP methods |
| 20 | + |
| 21 | +The following diagram illustrates one possible relation between abstract rights, operation verbs and HTTP methods. |
| 22 | +It is an example to support the interpretation of the normative mapping in xref:access-rule-model.adoc#table-rights-to-verbs[]. |
| 23 | + |
| 24 | +[plantuml,annex-rights-verbs-http-methods,svg] |
| 25 | +.... |
| 26 | +include::partial$diagrams/rights-verbs-http-methods.puml[] |
| 27 | +.... |
| 28 | + |
| 29 | +== Example requests by right |
| 30 | + |
| 31 | +The following requests use real path templates from the published AAS Part 2 OpenAPI descriptions. |
| 32 | +They are representative examples for access control decisions on ROUTE objects. |
| 33 | +For client-addressable routes with create-or-replace or upsert semantics, the required right depends on whether the addressed resource already exists. |
| 34 | +In the examples below, `PUT /api/v3/submodels/{id}` and `POST /api/v3/lookup/shells/{someencodedid}` therefore appear under both CREATE and UPDATE with different preconditions. |
| 35 | + |
| 36 | +=== CREATE |
| 37 | + |
| 38 | +Here are endpoints that can need CREATE rights to create new resources or entries in the repository or registry. PUT endpoints with create-or-replace semantics can require UPDATE instead of CREATE rights if the addressed resource already exists. |
| 39 | + |
| 40 | +Example 1: create a new AAS in the repository by POST. |
| 41 | + |
| 42 | +[source,http] |
| 43 | +---- |
| 44 | +POST /api/v3/shells |
| 45 | +---- |
| 46 | + |
| 47 | +Example 2: create a new submodel at a route by PUT if the addressed submodel does not yet exist. |
| 48 | + |
| 49 | +[source,http] |
| 50 | +---- |
| 51 | +PUT /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU |
| 52 | +---- |
| 53 | + |
| 54 | +Example 3: create a new submodel element in a collection by POST. |
| 55 | + |
| 56 | +[source,http] |
| 57 | +---- |
| 58 | +POST /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU/submodel-elements |
| 59 | +---- |
| 60 | + |
| 61 | +Example 4: create a lookup entry by POST if the addressed entry does not yet exist. |
| 62 | + |
| 63 | +[source,http] |
| 64 | +---- |
| 65 | +POST /api/v3/lookup/shells/someencodedid |
| 66 | +---- |
| 67 | + |
| 68 | +=== READ |
| 69 | + |
| 70 | +Here are endpoints that can need READ rights to access existing resources or entries in the repository or registry. VIEW right can be used as an alternative for GetAll endpointsif only existence information, references, identifiers, or descriptor entries shall be accessible. |
| 71 | + |
| 72 | +Example 1: read all AAS objects. |
| 73 | + |
| 74 | +[source,http] |
| 75 | +---- |
| 76 | +GET /api/v3/shells?limit=50 |
| 77 | +---- |
| 78 | + |
| 79 | +Example 2: read one submodel. |
| 80 | + |
| 81 | +[source,http] |
| 82 | +---- |
| 83 | +GET /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU |
| 84 | +---- |
| 85 | + |
| 86 | +Example 3: read one submodel element by path. |
| 87 | + |
| 88 | +[source,http] |
| 89 | +---- |
| 90 | +GET /api/v3/submodel/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA/submodel-elements/Identification/ManufacturerName |
| 91 | +---- |
| 92 | + |
| 93 | +Example 4: read all shell descriptors from the registry. |
| 94 | + |
| 95 | +[source,http] |
| 96 | +---- |
| 97 | +GET /api/v3/shell-descriptors |
| 98 | +---- |
| 99 | + |
| 100 | +Example 5: resolve AAS IDs through discovery. |
| 101 | + |
| 102 | +This is an example of a read-like search operation implemented as POST. |
| 103 | + |
| 104 | +[source,http] |
| 105 | +---- |
| 106 | +POST /api/v3/lookup/shellsByAssetLink |
| 107 | +---- |
| 108 | + |
| 109 | +=== UPDATE |
| 110 | + |
| 111 | +Here are endpoints that can need UPDATE rights to modify existing resources or entries in the repository or registry. For client-addressable routes with create-or-replace semantics, CREATE rights can be sufficient if the addressed resource does not yet exist. |
| 112 | + |
| 113 | +Example 1: replace an existing AAS resource by PUT. |
| 114 | + |
| 115 | +[source,http] |
| 116 | +---- |
| 117 | +PUT /api/v3/shells/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA |
| 118 | +---- |
| 119 | + |
| 120 | +Example 2: replace an existing submodel at a client-addressable route by PUT if the addressed submodel already exists. |
| 121 | + |
| 122 | +[source,http] |
| 123 | +---- |
| 124 | +PUT /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU |
| 125 | +---- |
| 126 | + |
| 127 | +Example 3: partially update a submodel by PATCH. |
| 128 | + |
| 129 | +[source,http] |
| 130 | +---- |
| 131 | +PATCH /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU |
| 132 | +---- |
| 133 | + |
| 134 | +Example 4: update the value-only representation of a submodel element. |
| 135 | + |
| 136 | +[source,http] |
| 137 | +---- |
| 138 | +PATCH /api/v3/submodel/submodel-elements/Identification/ManufacturerName/$value |
| 139 | +---- |
| 140 | + |
| 141 | +Example 5: update an AAS descriptor in the registry. |
| 142 | + |
| 143 | +[source,http] |
| 144 | +---- |
| 145 | +PUT /api/v3/shell-descriptors/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA |
| 146 | +---- |
| 147 | + |
| 148 | +Example 6: update a lookup entry by POST if the addressed entry already exists. |
| 149 | + |
| 150 | +[source,http] |
| 151 | +---- |
| 152 | +POST /api/v3/lookup/shells/someencodedid |
| 153 | +---- |
| 154 | + |
| 155 | +=== DELETE |
| 156 | + |
| 157 | +Here are endpoints that can need DELETE rights to delete existing resources or entries in the repository or registry. |
| 158 | + |
| 159 | +Example 1: delete a submodel from the repository. |
| 160 | + |
| 161 | +[source,http] |
| 162 | +---- |
| 163 | +DELETE /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA |
| 164 | +---- |
| 165 | + |
| 166 | +Example 2: delete a submodel element by path. |
| 167 | + |
| 168 | +[source,http] |
| 169 | +---- |
| 170 | +DELETE /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA/submodel-elements/Identification/ManufacturerName |
| 171 | +---- |
| 172 | + |
| 173 | +Example 3: delete a shell descriptor from the registry. |
| 174 | + |
| 175 | +[source,http] |
| 176 | +---- |
| 177 | +DELETE /api/v3/shell-descriptors/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA |
| 178 | +---- |
| 179 | + |
| 180 | +=== EXECUTE |
| 181 | + |
| 182 | +Here are endpoints that can need EXECUTE rights to invoke operations on the repository or registry. |
| 183 | + |
| 184 | +Example 1: synchronously invoke an Operation. |
| 185 | + |
| 186 | +[source,http] |
| 187 | +---- |
| 188 | +POST /api/v3/submodel/submodel-elements/Reset/invoke |
| 189 | +---- |
| 190 | + |
| 191 | +Example 2: asynchronously invoke an Operation. |
| 192 | + |
| 193 | +[source,http] |
| 194 | +---- |
| 195 | +POST /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9tYWludGVuYW5jZQ/submodel-elements/Reset/invoke-async |
| 196 | +---- |
| 197 | + |
| 198 | +Example 3: retrieve the status of an asynchronous invocation. |
| 199 | + |
| 200 | +[source,http] |
| 201 | +---- |
| 202 | +GET /api/v3/submodel/submodel-elements/Reset/operation-status/4a2a7aaf-6f44-4f88-bba2-0b0d2d3e7a10 |
| 203 | +---- |
| 204 | + |
| 205 | +=== VIEW |
| 206 | + |
| 207 | +VIEW is not bound to a dedicated HTTP method. |
| 208 | +In HTTP/REST APIs it is usually enforced on GET operations that only expose existence information, references, identifiers, or descriptor entries. |
| 209 | + |
| 210 | +Example 1: retrieve references instead of full resource content. |
| 211 | + |
| 212 | +[source,http] |
| 213 | +---- |
| 214 | +GET /api/v3/submodels/aHR0cHM6Ly9leGFtcGxlLmNvbS9zbS9uYW1lcGxhdGU/$reference |
| 215 | +---- |
| 216 | + |
| 217 | +Example 2: retrieve submodel references of an AAS. |
| 218 | + |
| 219 | +[source,http] |
| 220 | +---- |
| 221 | +GET /api/v3/shells/aHR0cHM6Ly9leGFtcGxlLmNvbS9hYXMvMTIzNA/submodel-refs |
| 222 | +---- |
| 223 | + |
| 224 | +Example 3: retrieve descriptor entries without accessing the hosted AAS content itself. |
| 225 | + |
| 226 | +[source,http] |
| 227 | +---- |
| 228 | +GET /api/v3/shell-descriptors |
| 229 | +---- |
| 230 | + |
| 231 | +== Notes for access rule authors |
| 232 | + |
| 233 | +* ROUTE literals should be defined against stable path families such as `/shells/*`, `/submodels/*`, `/shell-descriptors/*` or `/lookup/*` if authorization is intended for complete interfaces. |
| 234 | +* Exact ROUTE literals such as `/submodel/submodel-elements/Reset/invoke` are useful for single sensitive operations. |
0 commit comments