Diamra Developer Docs
All pages

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.

GEThttps://api.diamra.com/v1/views
HeaderWhat it is
Authorization
Required. Bearer and your API key.
Diamra-Customer-Token
Required. The customer's access_token from Log in, Register or Refresh.

The parameter goes in the query string.

ParameterWhat it is
project
Required. The project's id.
RequestShell
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-7a1c9e2f6b58
ResponseHTTP
HTTP/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    }  ]}
FieldWhat it is
status
The newest set of views: processing while Diamra draws it, then succeeded or failed. null when none was asked for. While a new set runs, and after one fails, the list keeps the views the customer had.
timing
While the status is processing: elapsed_ms and expected_ms. null otherwise. See Calls that take time.

Retrieve a view

Returns one view.

GEThttps://api.diamra.com/v1/views/{id}

Send the same two headers.

RequestShell
curl https://api.diamra.com/v1/views/e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37 \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN"
ResponseHTTP
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.

POSThttps://api.diamra.com/v1/views

Send the same two headers.

ParameterWhat it is
project
Required. The project, as an object.
project.id
Required. The project's id.
RequestShell
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"    }  }'
ResponseHTTP
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.

DELETEhttps://api.diamra.com/v1/views/{id}
RequestShell
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"
ResponseHTTP
HTTP/2 200content-type: application/jsonrequest-id: req_9a4e2c7b13f85d60{  "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37",  "deleted": true}

The view

id
The view's id. A new view of the same side gets a new one.
project.id
The project it shows.
view
front, top, left or bottom. A measurement gives its view's id and this side.
url
A public link to the view's image, a square WebP.
created_at
When Diamra made it, in Unix seconds.

Limits

One customer
2 calls a minute to Create new views.
Your store
20 calls a minute to Create new views, and 240 to List views and Retrieve a view together.

Over a limit, the call answers a 429 rate_limit, with Retry-After: 60. Delete a view has no limit.

Errors

AnswerWhen
400 parameter_missing
No project, or no id in it. param names it.
400 parameter_unknown
A parameter the call doesn't take, often a typo. param names it.
400 parameter_invalid
project isn't an object, or its id isn't a well-formed id. param names it.
400 resource_missing
project, or project.id, isn't a project of this customer in your store. The message gives the id.
401 api_key_invalid
No key, or one Diamra doesn't know. See API keys.
401 api_key_revoked
The key was revoked in your console.
401 customer_token_invalid
No access token, or one that ran out or was never valid. Refresh the session, or log the customer in again.
403 access_pending
Your store approves new customers first and hasn't approved this one. Approve them under Customers in your Bench.
403 plan_required
Your store isn't on the Retail plan. Its keys work again once it is.
403 measurements_disabled
Create new views, while your store doesn't let customers measure. Turn it on in your Bench's project settings.
404 resource_missing
No view with this id that this customer sees in your store.
429 rate_limit
Over a limit above.
503
The new views couldn't be started. Try again in a minute.
An errorHTTP
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."  }}