How it works
The usual path, from a roof to its file:1
Check the roof (optional)
POST /v1/esx-exports/checks answers with every problem it finds. No export is recorded and nothing is charged, so check as often as you like.2
Send the roof
POST /v1/esx-exports checks the roof and sends it to the export provider. The answer is 202 with the export and any warnings, usually status: processing.3
Poll the export
GET /v1/esx-exports/{id}, no more than once every 5 seconds, until the export is ready or failed.4
Ask for the file
POST /v1/esx-exports/{id}/download answers with a link to the ESX, valid for one hour. Fetch the file from the link without your OSA key.5
Correct it if you need to
POST /v1/esx-exports/{id}/versions sends a corrected roof to the same export, which is built again.esx-exports:create to check, send and correct a roof, and esx-exports:read to read exports and ask for the file. See Authentication.
Send a roof
A request has your id for the order (reference), the roof (input) and the property it is on. This one sends a gable roof, 40 by 30 ft, pitch 6/12, eaves 9 ft above the ground:
POST /v1/esx-exports/checks takes the same body, without the Idempotency-Key header. You can also send claim_number, end_user (who in your system asked) and your own metadata; each is returned as sent. The API reference lists every field.
The answer comes before the build finishes:
Idempotency-Keyis required. A retry with the same key within 24 hours returns the export as it is now and creates nothing new. Only a202is replayed: see Limits and idempotency.- One export per reference. A
referenceyou have already used, in the key’s environment, is refused with409 duplicate_export, which names the existing export. Send a correction as a new version of it. - The roof is checked every time, whether or not you checked it first.
202 creates an export. A 422, 409 or 503 records nothing and charges nothing.
Warnings
A roof is refused only for a critical problem, one that means it cannot be built. The answer is422 validation_failed with every problem found in errors, and nothing is recorded.
Every other problem is a warning, major or minor. The ESX is built anyway, and each warning says where it is and what OSA did about it. You can correct it in the ESX, or send a corrected version.
On the export, clean is true when there are no warnings, major_warnings and minor_warnings count them, and warnings lists at most 100, major ones first. Roof checks and problems lists every check and warning.
provider_messages holds anything the export provider said when it took the file: free text, usually empty, with no effect on clean. Don’t parse it.
Poll the export
ready or failed. With many exports in flight, spread your polls to stay inside your key’s rate limit, which is lower for a test key. Reading a processing export asks the export provider for the build’s status; it never sends or resends anything.
GET /v1/esx-exports shows each export as last recorded and refreshes nothing. Use the list to catch up or reconcile: see Polling.
An export moves between three statuses. A corrected roof takes it round again as a new version:
An export not
ready 10 minutes after its latest version was sent becomes failed with reason build_timeout. This is applied when the export is read by id, or when a version or its file is asked for; never by the list.
failure.detail is for people; match on reason. Statuses and reasons are open enums: treat an unknown status as processing and an unknown reason as build_failed.
Ask for the file
Before you ask, look atclean and major_warnings: the first time you ask for a live export’s ESX is charged, whether or not it has warnings.
download_url within one hour. After that, ask again for a fresh link; that is not another use. OSA does not keep the file: the link is to the export provider’s storage.
ready. One that is processing or failed answers 409 export_not_ready, and nothing is charged.
Correct a roof
Send the corrected roof to the same export, not as a new export: thereference is already used, and a new export is a new use when you ask for its file.
This sends the gable again, as you would after build_timeout. A corrected roof goes in the same place.
- Send
input, andpropertyonly if the address or location changed.Idempotency-Keyis required, as for sending a roof. - An export that is
readyorfailedtakes a new version. One stillprocessinganswers409 export_not_ready; check it again shortly. - The corrected roof is checked again. A critical problem answers
422 validation_failedand leaves the export as it was. - The export keeps its
idandreference, and itsversiongoes up by one. The answer is202, usuallystatus: processing: poll it as before. If the provider refused the corrected file, the export is alreadyfailedwith reasonbuild_refused.warnings, the two counts,clean,provider_messagesandfailuredescribe the latest version only. - The earlier ESX is gone. Once a new version is accepted, the earlier version’s ESX can no longer be asked for, even if the new build fails.
- It is not another use. If you already asked for the export’s ESX, asking for it again after the new version is not charged again.
If the export provider is unavailable
If the export provider can’t be reached, or fails part-way, the answer is503 export_provider_unavailable and nothing is charged. Wait for the number of seconds in Retry-After, then:
- Sending a roof. Nothing was created. Send the same request again with the same
Idempotency-Key. - Sending a version. If the provider failed before the version started to be sent, the export is left as it was. If it failed after sending started, the export is
failedwith reasonbuild_failed: itsversionhas gone up and the earlier file is no longer available. Either way, send the same request again (the sameIdempotency-Keyis fine); after a failed version it makes the next version. - Asking for the file. Ask again.
Test and live exports
An export sent with anosa_test_ key is a test export ("test": true). It is built on a test system and never charged.
Test and live exports never overlap, which is stricter than for claims: a test key sees only test exports and a live key only live ones. An export of the other environment answers 404 not_found and is never listed, and a reference is checked for duplicates only within the key’s environment. See Testing.