Measurements
Measurements are lines drawn on a project's views: the piece seen from the front, the top, the left and the bottom. Your team draws them on your Bench, and your customer can too if your store lets them. Both see every line, and both can change any of them. Every call takes your API key and the customer's access token from Auth.
Add a measurement
Adds a line to one of the project's views. It answers the measurement, with its length.
https://api.diamra.com/v1/measurementscurl https://api.diamra.com/v1/measurements \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "view": { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37" }, "type": "measurement", "from": { "x": 0.4875, "y": 0.7104 }, "to": { "x": 0.4875, "y": 0.7358 }, "label": "shank thickness" }'HTTP/2 201content-type: application/jsonrequest-id: req_0c5e8b3f61d74a92{ "id": "6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "view": "front" }, "type": "measurement", "label": "shank thickness", "mm": 1.6, "text": null, "from": { "x": 0.4875, "y": 0.7104 }, "to": { "x": 0.4875, "y": 0.7358 }, "drawn_by": "customer", "created_at": 1794325212}A measurement's mmis null until the project has a reference. Your store decides whether customers may measure, with the Measure switch in your Bench's project settings. While it's off, the call answers 403 measurements_disabled.
Adding a reference replaces the project's reference, on whichever view it was. The old line is deleted, and every measurement's length is worked out again from the new one.
List measurements
Returns every line on the project's views, oldest first, your team's and the customer's.
https://api.diamra.com/v1/measurementsSend the same two headers. The parameters go in the query string.
curl -G https://api.diamra.com/v1/measurements \ -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_7a2d9f4c06e81b35{ "object": "list", "url": "/v1/measurements", "has_more": false, "data": [ { "id": "2b9e7d41-5c08-4f6a-b3d2-8a1e6c0f9b57", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "view": "front" }, "type": "reference", "label": "inner diameter", "mm": 17.3, "text": null, "from": { "x": 0.3625, "y": 0.5875 }, "to": { "x": 0.6375, "y": 0.5875 }, "drawn_by": "customer", "created_at": 1794325212 }, { "id": "a4d81f3c-6e29-4b75-9c0a-3f5e7b2d8c16", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "view": "front" }, "type": "callout", "label": "bezel", "mm": null, "text": "14K yellow gold", "from": { "x": 0.6633, "y": 0.3519 }, "to": { "x": 0.8211, "y": 0.2042 }, "drawn_by": "owner", "created_at": 1794325212 }, { "id": "6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64", "project": { "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58" }, "view": { "id": "e1a7c4d2-8b3f-4e69-a05d-6c2f9b8e1d37", "view": "front" }, "type": "measurement", "label": "shank thickness", "mm": 1.6, "text": null, "from": { "x": 0.4875, "y": 0.7104 }, "to": { "x": 0.4875, "y": 0.7358 }, "drawn_by": "customer", "created_at": 1794325212 } ]}Retrieve a measurement
Returns one line.
https://api.diamra.com/v1/measurements/{id}curl https://api.diamra.com/v1/measurements/6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"Update a measurement
Changes any line of the project, your team's too: its points, a reference's mm, a callout's text or its label. Send only what changes. A line keeps its type and its view: to move one, delete it and add another.
https://api.diamra.com/v1/measurements/{id}Send the same two headers. It takes from, to, mm, text and label, as Add a measurement does; a label of null removes it.
curl https://api.diamra.com/v1/measurements/6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "to": { "x": 0.4875, "y": 0.739 } }'A change to the reference works out every measurement's length again.
Delete a measurement
Deletes any line of the project. Deleting the reference leaves every measurement without a length until a new reference is added.
https://api.diamra.com/v1/measurements/{id}curl -X DELETE https://api.diamra.com/v1/measurements/6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"HTTP/2 200content-type: application/jsonrequest-id: req_3f8b1e6a29c05d74{ "id": "6f1c2a8e-9d47-4b3a-8e25-0c7f3b9d1a64", "deleted": true}The measurement
Limits
Over a limit, the call answers a 429 rate_limit, with Retry-After: 60.
Errors
HTTP/2 400content-type: application/jsonrequest-id: req_9d4b2e7a15c38f06{ "error": { "type": "invalid_request_error", "code": "parameter_invalid", "message": "Only a reference takes mm. A measurement's length comes from the reference.", "param": "mm" }}