UNPKG

openapi-directory

Version:

Building & bundling https://github.com/APIs-guru/openapi-directory for easy use from JS

1 lines 24 kB
{"openapi":"3.0.0","info":{"description":"The Box Uploads API allows users to add a new file or add a new file version in the same way as uploading file.","license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"title":"Box 2.0 Uploads","version":"2.0","x-apisguru-categories":["cloud"],"x-logo":{"url":"https://twitter.com/BoxHQ/profile_image?size=original"},"x-origin":[{"format":"swagger","url":"https://raw.githubusercontent.com/box/box-openapi/master/v2.0/upload.openapi-v2.json","version":"2.0"}],"x-providerName":"box.com","x-serviceName":"upload"},"security":[{"OAuth2Security":[]}],"paths":{"/files/content":{"post":{"description":"Use the Uploads API to allow users to add a new file.","externalDocs":{"url":"https://docs.box.com/reference#upload-a-file"},"operationId":"uploadFile","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"attributes":{"description":"File attributes","type":"string"},"file":{"description":"File to upload","type":"string","format":"binary"}},"required":["attributes","file"]}}}},"responses":{"201":{"description":"The upload would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileList"}}}},"409":{"description":"Name collision occurs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"File upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Upload File","tags":["FileUpload"]}},"/files/upload_sessions":{"post":{"description":"Use the Uploads API to create a new session to upload a new file.","operationId":"createUploadSession","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadSessionRequest"}}},"required":true},"responses":{"201":{"description":"The upload session creation would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadSession"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Name collision occurs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"Preconditioned failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"File upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Create File Upload Session","tags":["ChunkedUpload"]}},"/files/upload_sessions/{SESSION_ID}":{"delete":{"description":"Abort the upload session and discard all data uploaded. This cannot be reversed.","operationId":"abortUploadSession","parameters":[{"in":"path","name":"SESSION_ID","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Abort would be successful"},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Get upload session error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Abort Upload Session","tags":["ChunkedUpload"]},"get":{"description":"Return the information about this session.","operationId":"getUploadSession","parameters":[{"in":"path","name":"SESSION_ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadSession"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Get upload session error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Upload Session Details","tags":["ChunkedUpload"]},"put":{"description":"Upload a part of the file to this session.","operationId":"uploadPart","parameters":[{"in":"path","name":"SESSION_ID","required":true,"schema":{"type":"string"}},{"description":"The message digest of the partbody, formatted as specified by RFC 3230. The usage is sha=BASE64_ENCODED_DIGEST. Currently only SHA-1 is supported.As per RFC 3230, the output from SHA-1 algorithm must be Base64 encoded.","in":"header","name":"Digest","required":true,"schema":{"type":"string"}},{"description":"Byte range of part within overall file. E.g: bytes 8388608-16777215/445856194. It must not overlap with the range of a part already uploaded to this session.","in":"header","name":"Content-Range","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/octet-stream":{"schema":{"format":"byte","type":"string"}}},"description":"Part bytes","required":true},"responses":{"200":{"description":"Part upload would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadPartResponse"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Part conflict. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"Preconditioned failed. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"416":{"description":"Request range bit satisfiable. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Part upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Upload Part","tags":["ChunkedUpload"]}},"/files/upload_sessions/{SESSION_ID}/commit":{"post":{"description":"Create a Box file comprised of the uploaded parts.","operationId":"commitUploadSession","parameters":[{"in":"path","name":"SESSION_ID","required":true,"schema":{"type":"string"}},{"description":"The message digest of the file, formatted as specified by RFC 3230. The usage is sha=BASE64_ENCODED_DIGEST. Currently only SHA-1 is supported.As per RFC 3230, the output from SHA-1 algorithm must be Base64 encoded.","in":"header","name":"Digest","required":true,"schema":{"type":"string"}},{"description":"This is in the ‘etag’ field of the file object. See https://developer.box.com/v2.0/reference#if-match","in":"header","name":"If-Match","required":false,"schema":{"type":"string"}},{"description":"This is in the ‘etag’ field of the file object. See https://developer.box.com/v2.0/reference#if-match","in":"header","name":"If-Non-Match","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitRequest"}}},"required":true},"responses":{"201":{"description":"The file has been committed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileList"}}}},"202":{"description":"All parts have been uploaded but not yet processed. Use Get Upload Session API to get more information about the progress of processing the parts. Retry commit afterwards","headers":{"Retry-After":{"description":"Indicates the number of seconds the client should wait before attempting their commit request again.","schema":{"type":"integer"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"There is already a file with the same name in the target folder.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"The If-Match condition failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Part upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Commit Upload","tags":["ChunkedUpload"]}},"/files/upload_sessions/{SESSION_ID}/parts":{"get":{"description":"Return the list of parts uploaded so far for this session.","operationId":"listParts","parameters":[{"in":"path","name":"SESSION_ID","required":true,"schema":{"type":"string"}},{"description":"Zero-based index of first part to return. Defaults to zero, if not specified.","in":"query","name":"offset","required":false,"schema":{"type":"integer","format":"int32"}},{"description":"How many parts to return. Defaults to 1000 if not specified, which is also the maximum value allowed.","in":"query","name":"limit","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"List would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartList"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Upload commit error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"List Parts","tags":["ChunkedUpload"]}},"/files/{FILE_ID}/content":{"post":{"description":"This method is used to upload a new version of an existing file in a user’s account. ","externalDocs":{"url":"https://docs.box.com/reference#upload-a-new-version-of-a-file"},"operationId":"uploadFileVersion","parameters":[{"in":"path","name":"FILE_ID","required":true,"schema":{"type":"string"}},{"description":"This is in the ‘etag’ field of the file object","in":"header","name":"If-Match","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"attributes":{"description":"File attributes","type":"string"},"file":{"description":"File to upload","type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"200":{"description":"The upload would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileList"}}}},"default":{"description":"File upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Upload File Version","tags":["FileUpload"]}},"/files/{FILE_ID}/upload_sessions":{"post":{"description":"Use the Uploads API to create a new session to upload a new version of existing file.","operationId":"createUploadSessionNewVersion","parameters":[{"in":"path","name":"FILE_ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionUploadSessionRequest"}}},"required":true},"responses":{"201":{"description":"The upload session creation would be successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadSession"}}}},"400":{"description":"Bad request. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Name collision occurs. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"Preconditioned failed. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request entity too large. See response body for details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"File upload error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Create File Upload Session","tags":["ChunkedUpload"]}}},"servers":[{"url":"https://upload.box.com/api/2.0"}],"components":{"securitySchemes":{"OAuth2Security":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://account.box.com/api/oauth2/authorize","tokenUrl":"https://api.box.com/oauth2/token","scopes":{}}}}},"schemas":{"BoxFile":{"allOf":[{"$ref":"#/components/schemas/FileReference"},{"properties":{"collections":{"items":{"$ref":"#/components/schemas/Collection"},"type":"array"},"comment_count":{"description":"The number of comments on a file.","format":"int64","type":"integer"},"content_created_at":{"description":"When the content of this file was created (more info).","format":"date-time","type":"string"},"content_modified_at":{"description":"When the content of this file was last modified (more info).","format":"date-time","type":"string"},"created_at":{"description":"When this file was created on Box’s servers.","format":"date-time","type":"string"},"created_by":{"$ref":"#/components/schemas/UserReference"},"description":{"description":"The description of this file.","type":"string"},"expiring_embed_link":{"description":"An expiring URL for an embedded preview session in an iframe. This URL will expire after 60 seconds and the session will expire after 60 minutes.","type":"string"},"extension":{"description":"Indicates the suffix, when available, on the file. By default, set to an empty string. The suffix usually indicates the encoding (file format) of the file contents or usage.","type":"string"},"file_version":{"$ref":"#/components/schemas/FileVersionReference"},"is_package":{"description":"Whether the file is a package. Used for Mac Packages used by iWorks.","type":"boolean"},"item_status":{"description":"Whether this item is deleted or not.","type":"string"},"lock":{"$ref":"#/components/schemas/Lock"},"modified_at":{"description":"When this file was last updated on the Box servers.","format":"date-time","type":"string"},"modified_by":{"$ref":"#/components/schemas/UserReference"},"owned_by":{"$ref":"#/components/schemas/UserReference"},"parent":{"$ref":"#/components/schemas/ItemReference"},"path_collection":{"$ref":"#/components/schemas/PathCollection"},"permissions":{"$ref":"#/components/schemas/FilePermissions"},"purged_at":{"description":"When this file will be permanently deleted.","format":"date-time","type":"string"},"shared_link":{"$ref":"#/components/schemas/SharedLink"},"size":{"description":"Size of this file in bytes.","format":"int64","type":"integer"},"tags":{"description":"All tags applied to this file.","items":{"type":"string"},"type":"array"},"trashed_at":{"description":"When this file was last moved to the trash.","format":"date-time","type":"string"},"version_number":{"description":"The version number of the file.","type":"string"},"watermark_info":{"$ref":"#/components/schemas/WatermarkInfo"}}}],"description":"File information describe file objects in Box, with attributes like who created the file, when it was last modified, and other information. The actual content of the file itself is accessible through the /files/{id}/content endpoint.","title":"File Object","type":"object"},"Collection":{"allOf":[{"$ref":"#/components/schemas/Reference"},{"properties":{"collection_type":{"description":"The type of the collection. This is used to determine the proper visual treatment for Box-internally created collections. Initially only “favorites” collection-type will be supported.","enum":["favorites"],"type":"string"},"name":{"description":"The name of this collection. The only collection currently available is named “Favorites”","type":"string"}}}],"description":"Collections contain information about the items contained inside of them, including files and folders. The only collection available currently is a “Favorites” collection. The contents of the collection are discovered in a similar way in which the contents of a folder are discovered.","title":"Collection Object","type":"object"},"CommitRequest":{"properties":{"attributes":{"additionalProperties":{"type":"object"},"description":"Optional. An array of attributes to set on the created file. See https://box-content.readme.io/reference#file-object","type":"object"},"parts":{"description":"An arrayof Part objects. MUST be ordered by offset.","items":{"$ref":"#/components/schemas/Part"},"type":"array"}},"type":"object"},"Error":{"properties":{"code":{"type":"string"},"context_info":{"properties":{"errors":{"items":{"properties":{"message":{"type":"string"},"name":{"type":"string"},"reason":{"type":"string"}},"type":"object"},"type":"array"}},"type":"object"},"help-url":{"type":"string"},"message":{"type":"string"},"request-id":{"type":"string"},"status":{"format":"int32","type":"integer"},"type":{"enum":["error"],"type":"string"}},"type":"object"},"FileList":{"allOf":[{"$ref":"#/components/schemas/Pagination"},{"properties":{"entries":{"items":{"$ref":"#/components/schemas/BoxFile"},"type":"array"}}}],"description":"A collection Tasks.","type":"object"},"FilePermissions":{"description":"The permissions that the current user has on the file","properties":{"can_download":{"type":"boolean"},"can_invite_collaborator":{"type":"boolean"},"can_preview":{"type":"boolean"},"can_rename":{"type":"boolean"},"can_set_share_access":{"type":"boolean"},"can_share":{"type":"boolean"},"can_upload":{"type":"boolean"},"cand_delete":{"type":"boolean"}},"type":"object"},"FileReference":{"allOf":[{"$ref":"#/components/schemas/ItemReference"},{"properties":{"sha1":{"description":"The sha1 hash of this file.","type":"string"}}}],"description":"It references either a file or a folder","type":"object"},"FileUploadSessionRequest":{"properties":{"file_name":{"description":"Name of new file","type":"string"},"file_size":{"description":"The total number of bytes in the file to be uploaded","format":"int64","type":"integer"},"folder_id":{"description":"The ID of the folder that will contain the new file","type":"string"}},"type":"object"},"FileVersionReference":{"allOf":[{"$ref":"#/components/schemas/Reference"},{"properties":{"sha1":{"description":"The sha1 hash of this file.","type":"string"}}}],"description":"The version information of the file.","type":"object"},"ItemReference":{"allOf":[{"$ref":"#/components/schemas/Reference"},{"properties":{"etag":{"description":"A unique string identifying the version of this folder.\nMay be null for some folders such as root or trash.","type":"string"},"name":{"description":"The name of the folder.","type":"string"},"sequence_id":{"description":"A unique ID for use with the /events endpoint.\nMay be null for some folders such as root or trash.","type":"string"}}}],"description":"It references either a file or a folder","type":"object"},"Lock":{"allOf":[{"$ref":"#/components/schemas/Reference"},{"properties":{"created_at":{"format":"date-time","type":"string"},"created_by":{"$ref":"#/components/schemas/UserReference"},"expired_at":{"format":"date-time","type":"string"},"is_download_prevented":{"type":"boolean"}}}],"description":"The lock held on the file.","type":"object"},"Pagination":{"properties":{"limit":{"format":"int64","type":"integer"},"offset":{"format":"int64","type":"integer"},"order":{"items":{"properties":{"by":{"type":"string"},"direction":{"type":"string"}},"type":"object"},"type":"array"},"total_count":{"format":"int64","type":"integer"}},"type":"object"},"Part":{"properties":{"offset":{"format":"int64","type":"integer"},"part_id":{"type":"string"},"sha1":{"type":"string"},"size":{"format":"int64","type":"integer"}},"type":"object"},"PartList":{"properties":{"entries":{"description":"An array of parts","items":{"$ref":"#/components/schemas/Part"},"type":"array"},"limit":{"description":"The limit that was used for these entries. This will be the same as the limit query parameter unless that value exceeded the maximum value allowed.","format":"int32","type":"integer"},"offset":{"description":"The 0-based offset of the first entry in this set. This will be the same as the offset query parameter.","format":"int32","type":"integer"},"total_count":{"description":"This will always be equal to the number of expected parts in the session (i.e. ceiling(file size / part size)).","format":"int32","type":"integer"}},"type":"object"},"PathCollection":{"allOf":[{"$ref":"#/components/schemas/Pagination"},{"properties":{"entries":{"items":{"$ref":"#/components/schemas/ItemReference"},"type":"array"}}}],"description":"The path of folders, starting at the root.","type":"object"},"Reference":{"properties":{"id":{"type":"string"},"type":{"enum":["folder","file","user","file_version","lock","collaboration","comment","task","web_link","collection","task_assignment","event","realtime_server","webhook_event","webhook","enterprise","invite","email_alias","group","group_membership","device_pinner","retention_policy","retention_policy_assignment","file_version_retention","legal_hold_policy","legal_hold_policy_assignment","legal_hold","upload_session"],"type":"string"}},"type":"object"},"SharedLink":{"properties":{"access":{"type":"string"},"download_count":{"format":"int64","type":"integer"},"download_url":{"type":"string"},"effective_access":{"type":"string"},"is_password_enabled":{"type":"boolean"},"password":{"type":"string"},"permissions":{"$ref":"#/components/schemas/SharedLinkPermissions"},"preview_count":{"format":"int64","type":"integer"},"unshared_at":{"type":"string"},"url":{"type":"string"},"vanity_url":{"type":"string"}},"type":"object"},"SharedLinkPermissions":{"properties":{"can_download":{"type":"boolean"},"can_preview":{"type":"boolean"}},"type":"object"},"UploadPartResponse":{"properties":{"part":{"$ref":"#/components/schemas/Part"}},"type":"object"},"UploadSession":{"allOf":[{"$ref":"#/components/schemas/Reference"},{"properties":{"num_parts_processed":{"description":"Tracks Box’s progress in processing all the parts that have been uploaded. Always equal to 0 when creating new upload session. In other cases, this will be the number of parts that have been processed by server. When all parts have been uploaded, but Commit API returned 202, you can check this value == total_parts to check if file was uploaded.","format":"int32","type":"integer"},"part_size":{"description":"The part size in bytes that must be used for all parts of this session. Only the last part is allowed to be of a smaller size.","format":"int64","type":"integer"},"session_endpoints":{"$ref":"#/components/schemas/UploadSessionEndpoints"},"session_expires_at":{"description":"UTC Time in RFC 3339 date timeformat: 2016-04-17T09:12:36-00:00.","format":"date-time","type":"string"},"total_parts":{"description":"The total number of parts expected in this session, as determined by the file size and part size.","format":"int32","type":"integer"}}}],"description":"Upload Session.","type":"object"},"UploadSessionEndpoints":{"description":"URLs for all other possible calls to this session.","properties":{"abort":{"description":"The URL for abort API.","type":"string"},"commit":{"description":"The URL for commit API.","type":"string"},"list_parts":{"description":"The URL for list parts API.","type":"string"},"log_event":{"description":"The URL for log event API.","type":"string"},"status":{"description":"The URL for status API.","type":"string"},"upload_part":{"description":"The URL for upload part API.","type":"string"}},"type":"object"},"UserReference":{"description":"It references a user","properties":{"id":{"description":"Unqiue string identifying this user.","type":"string"},"login":{"description":"The email address this user uses to login.","type":"string"},"name":{"description":"Name of this user","type":"string"},"type":{"enum":["user"],"type":"string"}},"type":"object"},"VersionUploadSessionRequest":{"properties":{"file_name":{"description":"Name of new file","type":"string"},"file_size":{"description":"The total number of bytes in the file to be uploaded","format":"int64","type":"integer"}},"type":"object"},"WatermarkInfo":{"items":{"properties":{"is_watermarked":{"type":"boolean"}}},"type":"array"}}}}