Skip to content

Commit

Permalink
fix: presignedUrl docs response-content-type is only meant for GET/HE…
Browse files Browse the repository at this point in the history
…AD (minio#1276)
  • Loading branch information
harshavardhana authored Dec 6, 2021
1 parent baf330a commit 00335c1
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ __Parameters__
__Example__
```java
// Check whether 'my-bucketname' exists or not.
boolean found =
boolean found =
minioClient.bucketExists(BucketExistsArgs.builder().bucket("my-bucketname").build());
if (found) {
System.out.println("my-bucketname exists");
Expand Down Expand Up @@ -1130,7 +1130,7 @@ minioClient.disableObjectLegalHold(
Enables legal hold on an object.

__Parameters__

| Parameter | Type | Description |
|:---------------|:------------------------------|:-------------|
| ``args`` | _[EnableObjectLegalHoldArgs]_ | Argumments. |
Expand Down Expand Up @@ -1254,7 +1254,7 @@ minioClient.downloadObject(
Gets retention configuration of an object.

__Parameters__

| Parameter | Type | Description |
|:---------------|:---------------------------|:--------------|
| ``args`` | _[GetObjectRetentionArgs]_ | Arguments. |
Expand Down Expand Up @@ -1304,7 +1304,7 @@ Tags tags = minioClient.getObjectTags(

Gets presigned URL of an object for HTTP method, expiry time and custom request parameters.

__Parameters__
__Parameters__
| Parameter | Type | Description |
|:------------|:-------------------------------|:-------------|
| ``args`` | _[GetPresignedObjectUrlArgs]_ | Arguments. |
Expand All @@ -1315,42 +1315,53 @@ Gets presigned URL of an object for HTTP method, expiry time and custom request

__Example__
```java
// Get presigned URL of an object for HTTP method, expiry time and custom request parameters.
// Get presigned URL string to download 'my-objectname' in 'my-bucketname'
// with an expiration of 2 hours.
//
// Additionally also add 'response-content-type' to dynamically set content-type
// for the server response.
Map<String, String> reqParams = new HashMap<String, String>();
reqParams.put("response-content-type", "application/json");

String url =
minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.DELETE)
.method(Method.GET)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(24 * 60 * 60)
.expiry(2, TimeUnit.HOURS)
.extraQueryParams(reqParams)
.build());
System.out.println(url);

// Get presigned URL string to upload 'my-objectname' in 'my-bucketname'
// with response-content-type as application/json and life time as one day.
Map<String, String> reqParams = new HashMap<String, String>();
reqParams.put("response-content-type", "application/json");

// Get presigned URL string to upload 'my-objectname' in 'my-bucketname'
// with an expiration of 1 day.
String url =
minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.PUT)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(1, TimeUnit.DAYS)
.extraQueryParams(reqParams)
.build());
System.out.println(url);

// Get presigned URL string to download 'my-objectname' in 'my-bucketname' and its life time
// is 2 hours.
// Get presigned URL string to lookup metadata for 'my-objectname' in 'my-bucketname'
// with an expiration of 2 hours.
//
// Additionally also add 'response-content-type' to dynamically set content-type
// for the server metadata response.
Map<String, String> reqParams = new HashMap<String, String>();
reqParams.put("response-content-type", "application/json");

String url =
minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.GET)
.method(Method.HEAD)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(2, TimeUnit.HOURS)
.extraQueryParams(reqParams)
.build());
System.out.println(url);
```
Expand Down Expand Up @@ -1649,7 +1660,7 @@ stream.close();
Sets retention configuration to an object.

__Parameters__

| Parameter | Type | Description |
|:-----------------|:---------------------------|:-------------|
| ``args`` | _[SetObjectRetentionArgs]_ | Arguments. |
Expand Down

0 comments on commit 00335c1

Please sign in to comment.