百度智能云

All Product Document

          Cloud File Storage

          API Calling Instructions

          API calls follow the HTTP protocol, and each Region adopts a different domain name, and the specific domain name is cfs.{region}.agilecloud.com. The data exchange format is JSON, and all request/response body contents are encoded in UTF-8.The fsId used in the URL parameter is the unique resource identifier of the file system.

          Note: 1.Before using the API interface, please enter the "Identity Verification" page for "Enterprise Authentication" or "Personal Authentication" according to the actual situation of the user. For detailed operation steps, please see "Identity Verification".
          2.For region information, please see Service Domain Name.

          API Authentication Mechanism

          The security authentication of all API utilizes the Access Key and request signature mechanism. Access Key consists of Access Key ID and Secret Key, both of which are strings. For each HTTP request, the algorithm described below is utilized to generate one authentication string. The authentication string is submitted in the Authorization header. The server verifies the correctness of authentication string based on the generating algorithm. The format of the authentication string is bce-auth-v{version}/{accessKeyId}/{timestamp}/{expirationPeriodInSeconds}/{signedHeaders}/{signature}.

          • The version stands for a positive integer.
          • The timestamp stands for the UTC time when the signature is generated.
          • The expirationPeriodInSeconds stands for the expiration period of signature.
          • The signedHeaders stands for the header list involved in the signature algorithm. The headers are separated by a semicolon (;), e.g. host; x-bce-date. The list is arranged in lexicographic order. (This API signature only utilizes two headers of host and x-bce-date.)
          • The signature is the 256-bit signed sexadecimal notation, and composed of 64 lower-case letters.

          After cloud platform receives a request of users, the system will use the same SK and authentication mechanism to generate an authentication string, and compare it with the authentication string contained in the user request. If the two authentication strings are the same, the system considers that the user has the designated operation permission, and executes the related operations; if the two authentication strings are different, the system will ignore the operation and return an error code.

          For details of authentication mechanism, please see Authentication Mechanism.

          Idempotency

          Users may try to resend a request if they encounter a request timeout or an internal server error when calling an interface. At this time, users can avoid creating more resources than expected by using the clientToken parameter to ensure the idempotency of the request.

          Idempotency is based on clientToken, an ASCII string no longer than 64 bits usually placed in a query string such as http://bcc.bj.agilecloud.com/v1/instance? clientToken=be31b98c-5e41-4838-9830-9be700de5a20.

          If the user calls the creation interface with the same clientToken value, the server will return the same request result. Therefore, when the user encounters an error and retries, he can provide the same clientToken value to ensure that only one resource is created. If the user provides a used clientToken, but other request parameters (including queryString and requestBody) are different or even URL path is different, the error code of IdempotentParameterMismatch will be returned.

          The clientToken is valid for 24 hours, subject to the last time when the server receives the clientToken. That is, if the client continuously sends the same clientToken, the clientToken will be valid for a long time.

          Date and Time Specification

          There are various methods to express date and time. For the sake of uniformity, unless it is a convention or a corresponding specification, wherever the date and time is required, UTC time shall be used, ISO 8601 shall be followed , and the following constraints shall be met:

          1.Fields expressing the date all utilize the YYYY-MM-DD format, e.g.2014-06-01 which means June 1, 2014. 2.Fields expressing time all utilize the hh:mm:ss format, with the capital letter Z added at the end, which means UTC time. E.g. 23:00:10Z means UTC time: 23:00:10. 3.When the date and time is combined, the capital letter T is added between the two items, e.g. 2014-06-01T23:00:10z means UTC time: 23:00:10 on June 1, 2014.

          Request Parameter

          The request parameters include the 4 kinds below:

          Parameter Type Description
          URI Generally used to indicate the operation entity, e.g. PUT / v1/ cfs/{ fsId}.
          Query String Request parameters carried in URL.
          Header Passed by the HTTP header, e.g. x-bce-date.
          Request Body Request data body organized in JSON format.

          Return Value Description

          There are two types of return values:

          Return Content Description
          HTTP Status Code E.g. 200,400,403,404, etc.
          Response Body Response data body organized in JSON format.

          Public Request Header

          The following table lists the common headers carried by all CFS API. The standard header of the HTTP protocol is not listed here.

          Header Required or not Description
          Authorization Yes Signature string. For the method of generating a signature string, please see the authentication mechanism.
          Content-Type Yes application/json; charset=utf-8
          x-bce-date Optional Signature Date

          Public Response Header

          The following table lists the common response headers for all CFS API. The standard response header of the HTTP protocol is not listed here.

          Header Description
          Content-Type application/json; charset=utf-8
          x-bce-request-id RequestID of this request

          Error Code

          The detailed error information is returned through Response Body in case of a request error, and the following format is followed:

          Parameter name Type Description
          code String Error code
          message String Err description
          requestId String RequestID of this request

          Example

          {
              "requestId" : "ae2225f7-1c2e-427a-a1ad-5413b762957d",
              "code" : "NoSuchKey",
              "message" : "The resource you requested does not exist"
          }

          BCE Common Error Code

          The following table lists the common error codes for all API. Each service should customize the error code on this basis.

          Code Message HTTP Status Code Description
          AccessDenied Access denied. 403 Forbidden No permission to access the corresponding resources
          InappropriateJSON The JSON you provided was well-formed and valid, but not appropriate for this operation. 400 Bad Request The JSON format in the request is correct, but doesn't meet the requirements semantically, such as lack of one necessary item or value type mismatch. For consideration of compatibility, all unrecognizable items should be ignored directly, and this error should not be returned.
          InternalError We encountered an internal error. Please try again. 500Internal Server Error All other undefined errors should not be utilized when there are specific corresponding other types of errors (including generic and service customized errors).
          InvalidAccessKeyId The Access Key ID you provided does not exist in our records. 403 Forbidden The Access Key ID does not exist.
          InvalidHTTPAuthHeader The HTTP authorization header is invalid. Consult the service documentation for details. 400 Bad Request The format of Authorization header is wrong.
          InvalidHTTPRequest There was an error in the body of your HTTP request. 400 Bad Request The HTTP body format is wrong. E.g. inconformity with the designated Encoding, etc.
          InvalidURI Could not parse the specified URI. 400 Bad Request The URI format is incorrect, such as mismatch of some service-defined keywords. For ID mismatch and other problems, a more specific error code should be defined, such as NoSuchKey.
          MalformedJSON The JSON you provided was not well-formed. 400 Bad Request The JSON format is invalid.
          InvalidVersion The API version specified was invalid. 404 Not Found The version number of URI is invalid.
          OptInRequired A subscription for the service is required. 403 Forbidden The corresponding service is not subscribed.
          PreconditionFailed The specified If-Match header doesn't match the ETag header. 412 Precondition Failed Refer to ETag for details.
          RequestExpired Request has expired. Timestamp date is XXX. 400 Bad Request The request has timed out. XXX should be changed to the value of x-bce-date. If there is only Date in the request, the Date should be changed to datetime.
          IdempotentParameterMismatch The request uses the same client token as a previous, but non-identical request. 403 Forbidden The API parameters corresponding to clientToken are non-identical.
          SignatureDoesNotMatch The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. Consult the service documentation for details. 400 Bad Request The signature attached in the Authorization header is inconsistent with the server authentication.

          CFS Service Error Code

          Error code Err description HTTP status code Semantics
          InstanceNotFound The specified CFS instance does not exist. 404 Not Found The specified CFS instance does not exist.
          InvalidFSType The FS TYPE is invalid. 400 Bad Request The file system type is wrong.
          InvalidFSName The FS NAME is invalid. 400 Bad Request The file system name does not meet requirements.
          InvalidFSProtocol The FS PROTOCOL is invalid. 400 Bad Request The file system does not support the protocol.
          AvailabilityZoneNotFound The specified availability zone does not exist. 400 Bad Request The zone set by the user does not exist.
          InvalidVpcId The vpc id is invalid. 400 Bad Request The vpc id is wrong
          CreateOrderFail We encountered an internal error. Please try again. 500 Internal Server Error Order creation failed, please try again later.
          DuplicateRequest The request is duplicate. 400 Bad Request Repeated request to create a file system instance.
          FsNumQuotaExceeded The number of CFS exceeded current quota. 413 Request Entity Too Large The number of CFS exceeded the limit of user quota.
          DropCreatingFS The fs is in creating, can not drop. 400 Bad Request Can not delete a file system instance being created.
          DropMountedFS The fs has mount target , please drop before clear mount target. 400 Bad Request Can not delete a file system instance with a mount target.
          FSNotInService The fs is not in service, not allow this operation. 400 Bad Request The file system service is not available.
          InvalidSubnetId The subnet id is invalid. 400 Bad Request The user-supplied subnet id is not available.
          InvalidVpcOrSubnet Invalid VPC ID or Subnet ID. 400 Bad Request The vpc id or subnet id supplied is incorrect when the mount target is in creating.
          AlreadyMounted The fs already has mount target in the same subnet. 400 Bad Request The file system has been mounted to the target subnet.
          DropCreatingMount The mount target is in creating, can not drop. 400 Bad Request Can not delete the mount target which is in creating.
          MountTargetNotFound The request mount target id is not found. 404 Not Found No requested mount target is found.
          MissingParameter A required parameter 'parameterName' is not supplied. 400 Bad Request The request is missing the required parameter "parameterName".
          InvalidParameter The parameter 'parameterName' is invalid. 400 Bad Request Illegal "parameterName" parameter.
          ResourceNotExists The resource does not exist. 404 Not Found The requested host is not configured in the region corresponding to the gateway.
          EOFException Unexpected EOF read on the socket. 400 Bad Request Read inputstream exception in request, usually eof.
          RequestTimeTooSkewed The difference between the request time and the server's time is too large. 403 Forbidden Timestamp is invalid in Authorization.
          ServiceError the dependency service is unavailable, host is {host} 424 Failed Dependency The dependency service is unavailable.
          UnsupportedProtocol The protocol '{http}' is not supported. 403 Forbidden The protocol verification does not support the request of http or https.
          QualifyNotPass The User has not pass qualify. 403 Forbidden Real-name authentication failed.
          RateLimit There are too many connections. The host is {host} 421 Misdirected Request The request is rate-limited.
          IllegalRequestUri The request URI contains some forbidden characters. 400 Bad Request The URL validity check failed.
          RequestUriForbidden The request URI is forbidden or not included. 400 Bad Request The requested URI is not included in the service allowed URIs.
          RequestEntityTooLargeException Request entity is too large, should not exceed 50M. 413 Request Entity Too Large multipart/ request, file size is greater than 50M.
          RequestEntityEmptyException Request entity is empty. 400 Bad Request multipart/ request, file byte stream is 0.
          ParseBodyException Parsing request body exception 500 Internal Server Error If there is a mapping file, an exception occurs when body is mapped.
          ServiceUnavailable Service or dependent service is unavailable. 503 Service Unavailable Network errors such as abnormal connection to the backend request or timeout.
          InvalidClientToken The client token is invalid, client token must be a ascii string of no longer than 64 bits. 400 Bad Request The clientToken value of the idempotent request is wrong.
          MultiRequestConflict The request is refused because of a previous is in progress. 409 Conflict During an idempotent request, the previous request is being processed and another request is received.
          Previous
          Overview
          Next
          Service Domain Name