API multipart and poll example
Platform api form fields, multi-file upload, and poll until JSON ready
Requires $API_BASE_URL and $API_TOKEN. Place invoice.pdf and receipt.pdf beside the .stk (or under files/).
Platform: api
Group: Tier F3 — multipart and poll
Scenario: Multipart upload with fields and files
When I api set header "Authorization" to "Bearer $API_TOKEN"
When I api set fields to '{"folder":"docs","type":"invoice"}'
When I api set field "name" to "Invoice"
When I api set file "main" to "invoice.pdf"
When I api set file "extra" to "receipt.pdf"
When I api post "/upload"
Then I api should status "201"
And I api should json path "$.ok" be "true"
And I api should json path "$.name" be "Invoice"
And I api should json path "$.files" be "2"
Scenario: Poll until job ready
When I api set header "Authorization" to "Bearer $API_TOKEN"
When I api post "/jobs" with body '{"type":"export"}'
Then I api should status "202"
When I store "@job-id" from api json "$.id"
When I api get "/jobs/@job-id"
And I api wait until json path "$.status" be "ready"
Then I api should json path "$.status" be "ready"