arazzo: 1.0.1 info: title: Backblaze Provision Bucket and Upload First File summary: Authorize, create a bucket, get its upload URL, and upload the first file end to end. description: >- A full greenfield onboarding chain that takes an empty account to a bucket holding its first object. It authorizes the account for the token and accountId, creates a new bucket, requests an upload URL scoped to that freshly created bucket, and uploads the initial file. The newly created bucketId flows from the create step directly into the upload-URL request, demonstrating cross-step data handoff. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: backblazeB2 url: ../openapi/backblaze-b2-native-api.yaml type: openapi workflows: - workflowId: provision-bucket-and-upload summary: Create a bucket and upload the first file into it. description: >- Authorizes the account, creates a new private bucket, obtains an upload URL for it, and uploads the first object. inputs: type: object required: - bucketName - fileName - contentType - contentLength - contentSha1 - fileContent properties: bucketName: type: string description: Globally unique name for the new bucket. bucketType: type: string description: Privacy setting for the bucket (allPublic or allPrivate). fileName: type: string description: URL-encoded name of the first file to upload. contentType: type: string description: MIME type of the file being uploaded. contentLength: type: integer description: Length of the file content in bytes. contentSha1: type: string description: SHA1 checksum of the file content. fileContent: type: string description: The raw file bytes to upload as the request body. steps: - stepId: authorize description: >- Log in to the B2 API to obtain the accountId and authorization token used by the bucket and upload steps. operationId: authorizeAccount successCriteria: - condition: $statusCode == 200 outputs: accountId: $response.body#/accountId authorizationToken: $response.body#/authorizationToken apiUrl: $response.body#/apiInfo/storageApi/apiUrl - stepId: createBucket description: Create the new bucket that will hold the uploaded file. operationId: createBucket requestBody: contentType: application/json payload: accountId: $steps.authorize.outputs.accountId bucketName: $inputs.bucketName bucketType: $inputs.bucketType successCriteria: - condition: $statusCode == 200 outputs: bucketId: $response.body#/bucketId - stepId: getUploadUrl description: >- Request an upload URL and token for the bucket that was just created, using the bucketId returned by the create step. operationId: getUploadUrl requestBody: contentType: application/json payload: bucketId: $steps.createBucket.outputs.bucketId successCriteria: - condition: $statusCode == 200 outputs: uploadUrl: $response.body#/uploadUrl uploadAuthorizationToken: $response.body#/authorizationToken - stepId: uploadFile description: >- Upload the first file to the new bucket using the upload authorization token and the required X-Bz content metadata headers. operationId: uploadFile parameters: - name: Authorization in: header value: $steps.getUploadUrl.outputs.uploadAuthorizationToken - name: X-Bz-File-Name in: header value: $inputs.fileName - name: Content-Type in: header value: $inputs.contentType - name: Content-Length in: header value: $inputs.contentLength - name: X-Bz-Content-Sha1 in: header value: $inputs.contentSha1 requestBody: contentType: application/octet-stream payload: $inputs.fileContent successCriteria: - condition: $statusCode == 200 outputs: fileId: $response.body#/fileId fileName: $response.body#/fileName outputs: bucketId: $steps.createBucket.outputs.bucketId fileId: $steps.uploadFile.outputs.fileId fileName: $steps.uploadFile.outputs.fileName