Skip to content

Commit 03502e0

Browse files
committed
improved and tested
1 parent 0ed068d commit 03502e0

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

articles/digital-twins/how-to-add-blobs.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ In addition to **Content-Type** and **Content-Disposition**, Azure Digital Twins
3131

3232
The four main JSON schemas are:
3333

34-
[![JSON schemas](media/how-to-add-blobs/blob-models-img.png)](media/how-to-add-blobs/blob-models-img.png#lightbox)
34+
[![JSON schemas](media/how-to-add-blobs/blob-models-swagger-img.png)](media/how-to-add-blobs/blob-models-swagger-img.png#lightbox)
3535

3636
JSON blob metadata conforms to the following model:
3737

@@ -191,7 +191,7 @@ curl -X POST "YOUR_MANAGEMENT_API_URL/spaces/blobs" \
191191
| YOUR_SPACE_ID | The ID of the space to associate the blob with |
192192
| PATH_TO_FILE | The path to your text file |
193193

194-
[![cURL example](media/how-to-add-blobs/curl-img.png)](media/how-to-add-blobs/curl-img.png#lightbox)
194+
[![cURL example](media/how-to-add-blobs/http-blob-post-through-curl-img.png)](media/how-to-add-blobs/http-blob-post-through-curl-img.png#lightbox)
195195

196196
A successful POST returns the ID of the new the blob.
197197

@@ -203,7 +203,7 @@ The following sections describe the core blob-related API endpoints and their fu
203203

204204
You can attach blobs to devices. The following image shows the Swagger reference documentation for your Management APIs. It specifies device-related API endpoints for blob consumption and any required path parameters to pass into them.
205205

206-
[![Device blobs](media/how-to-add-blobs/blobs-device-api-img.png)](media/how-to-add-blobs/blobs-device-api-img.png#lightbox)
206+
[![Device blobs](media/how-to-add-blobs/blobs-device-api-swagger-img.png)](media/how-to-add-blobs/blobs-device-api-swagger-img.png#lightbox)
207207

208208
For example, to update or create a blob and attach the blob to a device, make an authenticated HTTP PATCH request to:
209209

@@ -221,7 +221,7 @@ Successful requests return a JSON object as [described earlier](#blobs-response-
221221

222222
You can also attach blobs to spaces. The following image lists all space API endpoints responsible for handling blobs. It also lists any path parameters to pass into those endpoints.
223223

224-
[![Space blobs](media/how-to-add-blobs/blobs-space-api-img.png)](media/how-to-add-blobs/blobs-space-api-img.png#lightbox)
224+
[![Space blobs](media/how-to-add-blobs/blobs-space-api-swagger-img.png)](media/how-to-add-blobs/blobs-space-api-swagger-img.png#lightbox)
225225

226226
For example, to return a blob attached to a space, make an authenticated HTTP GET request to:
227227

@@ -241,7 +241,7 @@ A PATCH request to the same endpoint updates metadata descriptions and creates v
241241

242242
You can attach blobs to user models (for example, to associate a profile picture). The following image shows relevant user API endpoints and any required path parameters, like `id`:
243243

244-
[![User blobs](media/how-to-add-blobs/blobs-users-api-img.png)](media/how-to-add-blobs/blobs-users-api-img.png#lightbox)
244+
[![User blobs](media/how-to-add-blobs/blobs-users-api-swagger-img.png)](media/how-to-add-blobs/blobs-users-api-swagger-img.png#lightbox)
245245

246246
For example, to fetch a blob attached to a user, make an authenticated HTTP GET request with any required form data to:
247247

@@ -257,23 +257,41 @@ Successful requests return a JSON object as [described earlier](#blobs-response-
257257

258258
## Common errors
259259

260-
A common error involves not supplying the correct header information:
260+
* A common error involves not supplying the correct header information:
261261

262-
```JSON
263-
{
264-
"error": {
265-
"code": "400.600.000.000",
266-
"message": "Invalid media type in first section."
267-
}
268-
}
269-
```
262+
```JSON
263+
{
264+
"error": {
265+
"code": "400.600.000.000",
266+
"message": "Invalid media type in first section."
267+
}
268+
}
269+
```
270+
271+
To resolve this error, verify that the overall request has an appropriate **Content-Type** header:
272+
273+
* `multipart/mixed`
274+
* `multipart/form-data`
275+
276+
Also, verify that each *multipart chunk* has an appropriate corresponding **Content-Type**.
277+
278+
* A second common error arises when multiple blobs are assigned to the same resource in your [spatial intelligence graph](concepts-objectmodel-spatialgraph.md):
279+
280+
```JSON
281+
{
282+
"error": {
283+
"code": "400.600.000.000",
284+
"message": "SpaceBlobMetadata already exists."
285+
}
286+
}
287+
```
270288

271-
To resolve this error, verify that the overall request has an appropriate **Content-Type** header:
289+
> [!NOTE]
290+
> The **message** attribute will vary based on the resource.
272291
273-
* `multipart/mixed`
274-
* `multipart/form-data`
292+
Only one blob (of each kind) may be attached to each resource within your spatial graph.
275293

276-
Also, verify that each multipart chunk has a corresponding **Content-Type** as needed.
294+
To resolve this error, update the existing blob by using the appropriate API HTTP PATCH operation. Doing so will replace the existing blob data with the desired data.
277295

278296
## Next steps
279297

0 commit comments

Comments
 (0)