The server caps how long a request can run, how large a request can be and how much file space each business can use. You will be able to read each limit, change the two that you control and recover when one stops a request.
Before you start #
- Changing a limit needs access to the server's environment. See "Hosting the office server".
- Request rates have their own article, "API rate limits".
The limits #
| Limit | Value | Setting |
|---|---|---|
| Time for one request | 120 seconds | PSD_REQUEST_TIMEOUT_SECS |
| File storage for each business | 20480 MB | PSD_TENANT_STORAGE_QUOTA_MB (0 for no limit) |
| One photo | 10 MB | fixed |
| One upload request | 60 MB | fixed |
| One signature | about 300 KB | fixed |
| One JSON request | 16 MB | fixed |
Steps when a request stops #
- A request that runs past the time limit answers
request_timeout(408) and the server stops it. Send it again. A client that queues its work, such as the driver app, tries again by itself. - A photo or signature that would take the business past its storage allowance answers
storage_quota_exceeded(403) with the message "This business has used all its file storage". Retrying changes nothing, so the driver app shows the message and keeps the item in the Outbox. - Free space, or raise the allowance: set
PSD_TENANT_STORAGE_QUOTA_MBto a whole number of megabytes and restart the server. - A photo over 10 MB, or one in any format besides JPEG, PNG and WebP, is refused with
upload_failed(422). The other photos in the same request are still saved. - An upload request over 60 MB answers 413. Send fewer photos at a time.
Reading a stored file #
GET /files/:id returns the bytes of a photo, signature or document, with its own content type. JPEG, PNG, WebP and PDF open in the browser, and other types download. Send the sign-in token in the header and show the result from a blob address.
Who can read a file follows the record that owns it. Tow calls and the yard follow the tow roles, repair orders and inspections follow the shop roles, and an asset, document or expense is open to both. A driver reads only what they uploaded. A role without access gets 403, and a missing file gets 404.
Technical details
- The allowance counts the bytes of all stored files in the business. The check runs before a write, so a write that would pass the allowance is refused whole.
- Files live in
files/<business>/inside the data folder, under random names. The route serves a stored name only when it is a plain file name. nosniffstays on for every file answer.- The value of
PSD_REQUEST_TIMEOUT_SECSis a whole number of seconds above zero, and a bad value stops the server at start.
If something goes wrong #
- 408 on a large report: ask for a shorter date range.
- 403
storage_quota_exceededfor every driver: raise the allowance or clear old files. - 413 on photos: send fewer photos at a time.
- 403 on
GET /files/:id: your role cannot open files of that kind.