Create a Public Image
post
/storage/v1/Images
Request
Supported Media Types
- multipart/form-data
Root Schema : schema
Type:
Show Source
object
-
deleteAfter(optional):
integer
Amount of seconds after which the file will be deleted.
-
file:
string
Binary image content.
-
fileName:
string
Name of the image to create. May include path.Example:
image1.png
Response
Supported Media Types
- application/json
201 Response
Image creation status details.
Example Response (application/json)
{
"fileName":"images/image1.png",
"isPublic":true,
"fileUrl":"https://storage.example.com/v1/Storage-ocistest/B027/images/image1.png"
}
Examples
The following example shows how to create a public image by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL.
cURL Command
Note:
The command in this example uses the URL structurehttps://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/Images
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",
"chess.jpg\n",
"------WebKitFormBoundary3fkX18wB95KvCil5\n",
"Content-Disposition: form-data; name=\"file\"; \n",
"Content-Type: image/png\n",
"\n",
"???PNG image binary data\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": "images/201512312459/chess.jpg",
"isPublic": true,
"fileUrl": "https://tenant-base-url/v1/Storage-test/B027/images/201512312459/chess.jpg"
}