Projects
A project is a piece your customer wants made, started from one of a design's images. It opens on your Bench, where your team takes it from an estimate to the finished piece. Your server creates a project when the customer picks an image, reads it back, lists and searches the customer's projects, and deletes one if they change their mind. Every call takes your API key and the customer's access token from Auth. Each project belongs to that customer, in your store. The API comes with the Retail plan.
Create a project
Starts a project from the image the customer picked. Its id is in the design's images, which Retrieve a design returns.
https://api.diamra.com/v1/projectscurl https://api.diamra.com/v1/projects \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "design_image": { "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32" } }'HTTP/2 201content-type: application/jsonrequest-id: req_1f8c3a6e94d27b05{ "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58", "design_image": { "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32", "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/2.webp" }}An image has one project. If the image has a project already, the call answers it with a 200 and starts nothing new. A new project sends the project.started webhook event, like every new project in your store. Diamra also emails your team about it, unless you turned that email off in Diamra Email Delivery.
Retrieve a project
Returns the project. Its views, the piece drawn from each side, and the measurements drawn on them have calls of their own.
https://api.diamra.com/v1/projects/{id}Send the same two headers.
curl https://api.diamra.com/v1/projects/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"HTTP/2 200content-type: application/jsonrequest-id: req_7b2e0c5d18f94a63{ "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58", "design_image": { "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32", "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/2.webp" }}Delete a project
Takes the project off the customer's projects. Nothing is lost: your store keeps it on your Bench, with its views and everything else made for it.
https://api.diamra.com/v1/projects/{id}Send the same two headers.
curl -X DELETE https://api.diamra.com/v1/projects/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58 \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN"HTTP/2 200content-type: application/jsonrequest-id: req_6a0d4e2b71f93c58{ "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58", "deleted": true}Deleting it again answers 404, and so does retrieving it. To bring it back, create a project from the same image: the same project comes back with its id, and its views and measurements are as they were.
List projects
Returns the customer's projects, newest first, one page at a time. Each one is the same object that Retrieve a project returns. Deleted projects aren't listed.
https://api.diamra.com/v1/projectsSend the same two headers. The parameters go in the query string, and each one is optional.
curl -G https://api.diamra.com/v1/projects \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -d limit=1 \ --data-urlencode "search=oval sapphire"HTTP/2 200content-type: application/jsonrequest-id: req_9c4a1e7f30b2d865{ "object": "list", "url": "/v1/projects", "has_more": true, "data": [ { "id": "9e4f6c28-3a7b-4d0f-8c1e-5b2d0a3f7c69", "design_image": { "id": "7dbf5192-4e6a-4c8d-af2b-3a5e7c9dbf43", "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/3.webp" } } ]}has_more is true when more projects follow. For the next page, send the last project's id as starting_after, with the same limit and search.
curl -G https://api.diamra.com/v1/projects \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -d limit=1 \ --data-urlencode "search=oval sapphire" \ -d starting_after=9e4f6c28-3a7b-4d0f-8c1e-5b2d0a3f7c69When has_more is false, you have them all. A search that matches nothing returns an empty data list.
The project
Create a project and Retrieve a project answer it, and List projects returns a page of them in data. Delete a project answers its id and deleted: true.
Limits
Over a limit, the call answers a 429 rate_limit, with Retry-After: 60, and the message says which. Retrieve a project and Delete a project have no limit.
Errors
HTTP/2 400content-type: application/jsonrequest-id: req_3c7e1b94a05d2f86{ "error": { "type": "invalid_request_error", "code": "resource_missing", "message": "No design image 7c2e9a41-5d3b-4f8e-a1c6-0b9d4e2f8a73 of this customer in your store.", "param": "design_image.id" }}