Views
A project's views are the piece drawn from the front, the top, the left and the bottom, so it can be measured. Diamra makes them about a minute after the project starts. Your team and your customer draw measurements on them. Every call takes your API key and the customer's access token from Auth.
List views
Returns the project's views in this order: front, top, left, bottom. The list is empty until they're made. A view your team hasn't shared with the customer isn't listed. The list also says how the newest set is going, so you can ask again while it's processing.
https://api.diamra.com/v1/viewsThe parameter goes in the query string.
curl -G https://api.diamra.com/v1/views \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -d project=8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58HTTP/2 200content-type: application/jsonrequest-id: req_8e3b6d1a47c92f05{ "object": "list", "url": "/v1/views", "has_more": false, "status": "succeeded", "timing": null, "data": [ { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": "front", "url": "https://assets.diamra.com/measure-projections/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58/front/2b7e4c90-6a1d-4f3b-8e5c-9d0a1b2c3e4f.webp", "created_at": 1794325150 }, { "id": "3c9f0b6e-1d74-4a28-9e53-b7a2c4f8d016", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": "top", "url": "https://assets.diamra.com/measure-projections/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58/top/2b7e4c90-6a1d-4f3b-8e5c-9d0a1b2c3e4f.webp", "created_at": 1794325150 }, { "id": "7d2e5a91-4c08-4b6f-8a3d-0e9c1f6b2a45", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": "left", "url": "https://assets.diamra.com/measure-projections/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58/left/2b7e4c90-6a1d-4f3b-8e5c-9d0a1b2c3e4f.webp", "created_at": 1794325150 }, { "id": "b4f8e2c7-5a19-4d3e-9c60-2a7d8e1f5b93", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": "bottom", "url": "https://assets.diamra.com/measure-projections/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58/bottom/2b7e4c90-6a1d-4f3b-8e5c-9d0a1b2c3e4f.webp", "created_at": 1794325150 } ]}Retrieve a view
Returns one view.
https://api.diamra.com/v1/views/{id}Send the same two headers.
curl https://api.diamra.com/v1/views/e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"HTTP/2 200content-type: application/jsonrequest-id: req_2f9d5c8e61a04b37{ "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": "front", "url": "https://assets.diamra.com/measure-projections/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58/front/2b7e4c90-6a1d-4f3b-8e5c-9d0a1b2c3e4f.webp", "created_at": 1794325150}Create new views
Asks Diamra to draw the piece again from every side. The call answers at once, with its timing, and the new views take about a minute. Each one replaces the view of its side, with a new id. List the views every few seconds until their status is no longer processing. The lines drawn on the old views stay with them and leave the list.
https://api.diamra.com/v1/viewsSend the same two headers.
curl https://api.diamra.com/v1/views \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" } }'HTTP/2 202content-type: application/jsonrequest-id: req_6d1f8a3c50e94b27{ "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "status": "processing", "timing": { "elapsed_ms": 2310, "expected_ms": 36274 }}Your store decides whether customers may ask for new views, with the Measure switch in your Bench's project settings. While it's off, the call answers 403 measurements_disabled.
Delete a view
Takes the view off the customer's views, with the lines drawn on it. Your store keeps both on your Bench. To get a view of that side back, create new views.
https://api.diamra.com/v1/views/{id}curl -X DELETE https://api.diamra.com/v1/views/e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"HTTP/2 200content-type: application/jsonrequest-id: req_9a4e2c7b13f85d60{ "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "deleted": true}The view
Limits
Over a limit, the call answers a 429 rate_limit, with Retry-After: 60. Delete a view has no limit.
Errors
HTTP/2 403content-type: application/jsonrequest-id: req_4c7e1a9b25d03f86{ "error": { "type": "invalid_request_error", "code": "measurements_disabled", "message": "Your store doesn't let customers measure. Turn it on in your Bench's project settings." }}