API
The API lets your server work with your store. The path carries the version: inside /v1 things are only added, never renamed or removed. Every call except Health takes an API key, which you create in your store's Developer Console. The first calls sign your customers up and log them in on your own website, keep the photos they send, list your store's catalog, make jewelry designs from what they describe, those photos and your products, and start projects from the designs they pick. The API comes with the Retail plan.
https://api.diamra.com/v1Call it over HTTPS. A request over plain HTTP gets a 403 and is never redirected, so an http:// address fails on the first call instead of working while it sends your key in clear text.
Every response carries a Request-Id header. Quote it when you write to us about a call. Errors come as an error object with a type, a message in plain words and, where your code can act on it, a code to branch on. When one parameter is at fault, param names it.
Calls that take time
A design, an estimate and a new set of views take from a few seconds to about two minutes. The call that starts one answers at once, with a status of processing and a timing object. Ask for it again every few seconds until the status changes. A status means the same on all three:
The time left is expected_ms minus elapsed_ms. Some take longer than expected, so once elapsed_ms passes expected_ms, say it's almost ready instead of counting below zero. timing is null whenever the status isn't processing.
In this part
- API keysdmr_live_ keys from your Developer Console: send one in the Authorization header, keep it on your server, and revoke it at once if it leaks.
- AuthSign your customers up and log them in on your own website with an email and a password. Refresh and end sessions, and reset a forgotten password.
- ImagesUpload a customer's photo of a piece they like, or send a link to one: POST /v1/images answers an image id that a design can follow as a reference.
- CatalogList the products of the Shopify store or product feed you connected, with links to their photos: GET /v1/catalog/products. A design can start from any of them.
- DesignsMake jewelry designs from a customer's words, their photos, or both: POST /v1/designs answers the design's id at once, GET /v1/designs/{id} returns its images, and GET /v1/designs lists the customer's designs.
- ProjectsStart a project from the design image a customer picks, then list and search their projects, read one back or delete it. Each one opens on your Bench.
- ViewsA project's views for your customer: the piece drawn from the front, top, left and bottom, to measure on. List them, read one, ask for new ones or delete one.
- MeasurementsMeasure a project for your customer: set a reference length on one of its views, draw lines Diamra sizes from it, add notes, and change or delete them.
- EstimatesGet a price for a jewelry project: start an estimate, answer the questions that make it more exact, accept the price, and list every estimate the project has had, newest first.
- HealthGET https://api.diamra.com/v1/health tells you whether the Diamra API is up. It needs no key and is never billed, so it suits uptime monitors.