Create a File

post

/storage/v1/Files

Request

Supported Media Types
Body ()
Root Schema : schema
Type: object
Show Source
Back to Top

Response

Supported Media Types

201 Response

File creation status details.
Body
Example Response (application/json)
{
    "fileName":"files/filepath/file1.txt",
    "isPublic":true,
    "fileUrl":"https://storage.example.com/v1/Storage-ocistest/B027/files/filepath/file1.txt"
}
Back to Top

Examples

The following example shows how to create a public or private file to Oracle Public Cloud Storage by submitting a POST request on the REST resource using cURL. Files are limited to a contentType set of text/csv or application/directory. For more information about cURL, see Use cURL. See Importing and Exporting Users, Groups, and AppRoles for request and response examples for bulk import and export.

cURL Command

Note:

The command in this example uses the URL structure https://tenant-base-url/resource-path, where tenant-base-url represents the Identity Service URL, and the resource path represents the Identity Service API. See Send Requests for the appropriate URL structure to use.
curl
-X POST
-H "Content-Type:multipart/form-data"
-H "Authorization: Bearer <Access Token Value>"
https://tenant-base-url/storage/v1/Files

Example of Request Body

The following shows an example of the request body in JSON format:

[
  "------WebKitFormBoundary3fkX18wB95KvCil5\n",
  "Content-Disposition: form-data; name=\"fileName\"\n",
  "\n",
  "file.csv\n",
  "------WebKitFormBoundary3fkX18wB95KvCil5\n",
  "Content-Disposition: form-data; name=\"isPublic\"\n",
  "\n",
  "false\n",
  "------WebKitFormBoundary3fkX18wB95KvCil5\n",
  "Content-Disposition: form-data; name=\"contentType\"\n",
  "\n",
  "text/csv\n",
  "------WebKitFormBoundary3fkX18wB95KvCil5\n",
  "Content-Disposition: form-data; name=\"file\"; \n",
  "Content-Type: text/csv\n",
  "\n",
  "csv or ldif file\n",
  "------WebKitFormBoundary3fkX18wB95KvCil5--"
]

Example of Response Header

The following shows an example of the response header:

HTTP/1.1 201 Created
Content-Length: 10420\n,
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary3fkX18wB95KvCil5\n
Date: Wed, 09 Mar 2016 21:52:27 GMT

Example of Response Body

The following example shows the contents of the response body in JSON format:

{
  "fileName": "files/201512312459/file.csv",
  "isPublic": false,
  "fileUrl": "https://tenant-base-url/v1/Storage-test/B027/files/201512312459/file.csv"
}
Back to Top