Publiczne REST API
To samo REST API, z którego korzysta aplikacja Mercastra, opisane na podstawie kontraktu API w czasie budowania. Podsumowania i opisy endpointów oraz opisy pól pochodzą z tego kontraktu i są wyłącznie po angielsku.
Uwierzytelnianie
Żądania uwierzytelniają się ciasteczkiem session, które aplikacja ustawia przy logowaniu. Każde żądanie inne niż GET musi też wysłać nagłówek X-CSRF-Token z wartością ciasteczka csrf-token.
Nie ma jeszcze klucza API ani tokenu dla integracji zewnętrznych.
Stabilność
Każdy endpoint ma jeden z dwóch poziomów stabilności.
- experimental
- Może się zmienić bez uprzedzenia.
- stable
- Pozostaje zgodny z dokumentacją.
Endpointy
Każdy publiczny endpoint, w kolejności ścieżek. Każdy prowadzi do pełnego opisu na stronie swojego zasobu.
- post
/authenticateSign in with email and password - get
/estimates/{estimateId}Read an estimate - patch
/estimates/{estimateId}Update an estimate's name, recipient, markup or discount - delete
/estimates/{estimateId}Delete an estimate - post
/estimates/{estimateId}/confirmSnapshot an estimate's current content as a new revision - post
/estimates/{estimateId}/duplicateDuplicate an estimate - get
/estimates/{estimateId}/handoffsList an estimate's hand-offs - post
/estimates/{estimateId}/handoffsRecord that an estimate was handed off to its recipient - post
/estimates/{estimateId}/line-itemsAdd a line item to an estimate - patch
/estimates/{estimateId}/line-items/{lineItemId}Update a line item - delete
/estimates/{estimateId}/line-items/{lineItemId}Remove a line item - get
/estimates/{estimateId}/pdf-exportsList an estimate's PDF exports - post
/estimates/{estimateId}/pdf-exportsGenerate a PDF export of an estimate - get
/estimates/{estimateId}/pdf-exports/{pdfExportId}Download a PDF export's bytes - delete
/estimates/{estimateId}/pdf-exports/{pdfExportId}Delete a PDF export - get
/estimates/{estimateId}/revisionsList an estimate's revisions - get
/filesList files in a category and scope - post
/filesUpload a file - get
/files/{fileId}Download a file's bytes - get
/grids/{gridId}Read a grid - patch
/grids/{gridId}Rename a grid or change its icon size - delete
/grids/{gridId}Delete a grid - post
/grids/{gridId}/buttonsAdd a button to a grid - patch
/grids/{gridId}/buttons/{buttonId}Update a button - delete
/grids/{gridId}/buttons/{buttonId}Remove a button - post
/grids/{gridId}/duplicateDuplicate a grid - post
/logoutEnd the caller's session - get
/meRead the signed-in account's profile - patch
/meUpdate the signed-in account's profile - get
/me/data-exportExport everything stored about the account - get
/orders/{orderId}Read an order - patch
/orders/{orderId}Update an order's title, customer name or notes - patch
/orders/{orderId}/statusChange an order's status - get
/predefined-itemsList the catalog of predefined grid items, domains and templates - get
/workshopsList the caller's workshops - patch
/workshops/{workshopId}Update the workshop's profile - put
/workshops/{workshopId}/contextReplace the workshop's context notes - get
/workshops/{workshopId}/entitlementsRead the workshop's plan entitlements and quota usage - get
/workshops/{workshopId}/estimatesList a workshop's estimates - post
/workshops/{workshopId}/estimatesCreate an estimate in a workshop - get
/workshops/{workshopId}/estimates/most-used-line-itemsList the workshop's most-used line items - delete
/workshops/{workshopId}/grid-icons/{fileId}Delete a grid button icon - get
/workshops/{workshopId}/gridsList a workshop's grids - post
/workshops/{workshopId}/gridsCreate a grid in a workshop - get
/workshops/{workshopId}/ordersList a workshop's orders - post
/workshops/{workshopId}/ordersCreate an order in a workshop
Schematy
Nazwane kształty, do których odsyła typ pola: każda encja i model, udokumentowane raz, na osobnej stronie.
Błędy walidacji
Każdy endpoint, który waliduje treść żądania, odpowiada 400 o tym samym kształcie.
Sent with status 400 when the request body does not match the endpoint's schema. Each issue names the offending path and says what is wrong with it.
| Pole | Typ | Wymagane | Ograniczenia | Opis |
|---|---|---|---|---|
| status | string | Tak | const: "fail" | - |
| message | array of object | Tak | - | - |
| message[].path | array of string | number | Tak | - | - |
| message[].message | string | Tak | - | - |