github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/java/docs/ObjectsApi.md (about) 1 # ObjectsApi 2 3 All URIs are relative to */api/v1* 4 5 | Method | HTTP request | Description | 6 |------------- | ------------- | -------------| 7 | [**copyObject**](ObjectsApi.md#copyObject) | **POST** /repositories/{repository}/branches/{branch}/objects/copy | create a copy of an object | 8 | [**deleteObject**](ObjectsApi.md#deleteObject) | **DELETE** /repositories/{repository}/branches/{branch}/objects | delete object. Missing objects will not return a NotFound error. | 9 | [**deleteObjects**](ObjectsApi.md#deleteObjects) | **POST** /repositories/{repository}/branches/{branch}/objects/delete | delete objects. Missing objects will not return a NotFound error. | 10 | [**getObject**](ObjectsApi.md#getObject) | **GET** /repositories/{repository}/refs/{ref}/objects | get object content | 11 | [**getUnderlyingProperties**](ObjectsApi.md#getUnderlyingProperties) | **GET** /repositories/{repository}/refs/{ref}/objects/underlyingProperties | get object properties on underlying storage | 12 | [**headObject**](ObjectsApi.md#headObject) | **HEAD** /repositories/{repository}/refs/{ref}/objects | check if object exists | 13 | [**listObjects**](ObjectsApi.md#listObjects) | **GET** /repositories/{repository}/refs/{ref}/objects/ls | list objects under a given prefix | 14 | [**statObject**](ObjectsApi.md#statObject) | **GET** /repositories/{repository}/refs/{ref}/objects/stat | get object metadata | 15 | [**uploadObject**](ObjectsApi.md#uploadObject) | **POST** /repositories/{repository}/branches/{branch}/objects | | 16 17 18 <a id="copyObject"></a> 19 # **copyObject** 20 > ObjectStats copyObject(repository, branch, destPath, objectCopyCreation).execute(); 21 22 create a copy of an object 23 24 ### Example 25 ```java 26 // Import classes: 27 import io.lakefs.clients.sdk.ApiClient; 28 import io.lakefs.clients.sdk.ApiException; 29 import io.lakefs.clients.sdk.Configuration; 30 import io.lakefs.clients.sdk.auth.*; 31 import io.lakefs.clients.sdk.models.*; 32 import io.lakefs.clients.sdk.ObjectsApi; 33 34 public class Example { 35 public static void main(String[] args) { 36 ApiClient defaultClient = Configuration.getDefaultApiClient(); 37 defaultClient.setBasePath("/api/v1"); 38 39 // Configure HTTP basic authorization: basic_auth 40 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 41 basic_auth.setUsername("YOUR USERNAME"); 42 basic_auth.setPassword("YOUR PASSWORD"); 43 44 // Configure API key authorization: cookie_auth 45 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 46 cookie_auth.setApiKey("YOUR API KEY"); 47 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 48 //cookie_auth.setApiKeyPrefix("Token"); 49 50 // Configure API key authorization: oidc_auth 51 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 52 oidc_auth.setApiKey("YOUR API KEY"); 53 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 54 //oidc_auth.setApiKeyPrefix("Token"); 55 56 // Configure API key authorization: saml_auth 57 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 58 saml_auth.setApiKey("YOUR API KEY"); 59 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 60 //saml_auth.setApiKeyPrefix("Token"); 61 62 // Configure HTTP bearer authorization: jwt_token 63 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 64 jwt_token.setBearerToken("BEARER TOKEN"); 65 66 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 67 String repository = "repository_example"; // String | 68 String branch = "branch_example"; // String | destination branch for the copy 69 String destPath = "destPath_example"; // String | destination path relative to the branch 70 ObjectCopyCreation objectCopyCreation = new ObjectCopyCreation(); // ObjectCopyCreation | 71 try { 72 ObjectStats result = apiInstance.copyObject(repository, branch, destPath, objectCopyCreation) 73 .execute(); 74 System.out.println(result); 75 } catch (ApiException e) { 76 System.err.println("Exception when calling ObjectsApi#copyObject"); 77 System.err.println("Status code: " + e.getCode()); 78 System.err.println("Reason: " + e.getResponseBody()); 79 System.err.println("Response headers: " + e.getResponseHeaders()); 80 e.printStackTrace(); 81 } 82 } 83 } 84 ``` 85 86 ### Parameters 87 88 | Name | Type | Description | Notes | 89 |------------- | ------------- | ------------- | -------------| 90 | **repository** | **String**| | | 91 | **branch** | **String**| destination branch for the copy | | 92 | **destPath** | **String**| destination path relative to the branch | | 93 | **objectCopyCreation** | [**ObjectCopyCreation**](ObjectCopyCreation.md)| | | 94 95 ### Return type 96 97 [**ObjectStats**](ObjectStats.md) 98 99 ### Authorization 100 101 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 102 103 ### HTTP request headers 104 105 - **Content-Type**: application/json 106 - **Accept**: application/json 107 108 ### HTTP response details 109 | Status code | Description | Response headers | 110 |-------------|-------------|------------------| 111 | **201** | Copy object response | - | 112 | **400** | Validation Error | - | 113 | **401** | Unauthorized | - | 114 | **403** | Forbidden | - | 115 | **404** | Resource Not Found | - | 116 | **420** | too many requests | - | 117 | **0** | Internal Server Error | - | 118 119 <a id="deleteObject"></a> 120 # **deleteObject** 121 > deleteObject(repository, branch, path).force(force).execute(); 122 123 delete object. Missing objects will not return a NotFound error. 124 125 ### Example 126 ```java 127 // Import classes: 128 import io.lakefs.clients.sdk.ApiClient; 129 import io.lakefs.clients.sdk.ApiException; 130 import io.lakefs.clients.sdk.Configuration; 131 import io.lakefs.clients.sdk.auth.*; 132 import io.lakefs.clients.sdk.models.*; 133 import io.lakefs.clients.sdk.ObjectsApi; 134 135 public class Example { 136 public static void main(String[] args) { 137 ApiClient defaultClient = Configuration.getDefaultApiClient(); 138 defaultClient.setBasePath("/api/v1"); 139 140 // Configure HTTP basic authorization: basic_auth 141 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 142 basic_auth.setUsername("YOUR USERNAME"); 143 basic_auth.setPassword("YOUR PASSWORD"); 144 145 // Configure API key authorization: cookie_auth 146 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 147 cookie_auth.setApiKey("YOUR API KEY"); 148 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 149 //cookie_auth.setApiKeyPrefix("Token"); 150 151 // Configure API key authorization: oidc_auth 152 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 153 oidc_auth.setApiKey("YOUR API KEY"); 154 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 155 //oidc_auth.setApiKeyPrefix("Token"); 156 157 // Configure API key authorization: saml_auth 158 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 159 saml_auth.setApiKey("YOUR API KEY"); 160 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 161 //saml_auth.setApiKeyPrefix("Token"); 162 163 // Configure HTTP bearer authorization: jwt_token 164 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 165 jwt_token.setBearerToken("BEARER TOKEN"); 166 167 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 168 String repository = "repository_example"; // String | 169 String branch = "branch_example"; // String | 170 String path = "path_example"; // String | relative to the branch 171 Boolean force = false; // Boolean | 172 try { 173 apiInstance.deleteObject(repository, branch, path) 174 .force(force) 175 .execute(); 176 } catch (ApiException e) { 177 System.err.println("Exception when calling ObjectsApi#deleteObject"); 178 System.err.println("Status code: " + e.getCode()); 179 System.err.println("Reason: " + e.getResponseBody()); 180 System.err.println("Response headers: " + e.getResponseHeaders()); 181 e.printStackTrace(); 182 } 183 } 184 } 185 ``` 186 187 ### Parameters 188 189 | Name | Type | Description | Notes | 190 |------------- | ------------- | ------------- | -------------| 191 | **repository** | **String**| | | 192 | **branch** | **String**| | | 193 | **path** | **String**| relative to the branch | | 194 | **force** | **Boolean**| | [optional] [default to false] | 195 196 ### Return type 197 198 null (empty response body) 199 200 ### Authorization 201 202 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 203 204 ### HTTP request headers 205 206 - **Content-Type**: Not defined 207 - **Accept**: application/json 208 209 ### HTTP response details 210 | Status code | Description | Response headers | 211 |-------------|-------------|------------------| 212 | **204** | object deleted successfully | - | 213 | **401** | Unauthorized | - | 214 | **403** | Forbidden | - | 215 | **404** | Resource Not Found | - | 216 | **420** | too many requests | - | 217 | **0** | Internal Server Error | - | 218 219 <a id="deleteObjects"></a> 220 # **deleteObjects** 221 > ObjectErrorList deleteObjects(repository, branch, pathList).force(force).execute(); 222 223 delete objects. Missing objects will not return a NotFound error. 224 225 ### Example 226 ```java 227 // Import classes: 228 import io.lakefs.clients.sdk.ApiClient; 229 import io.lakefs.clients.sdk.ApiException; 230 import io.lakefs.clients.sdk.Configuration; 231 import io.lakefs.clients.sdk.auth.*; 232 import io.lakefs.clients.sdk.models.*; 233 import io.lakefs.clients.sdk.ObjectsApi; 234 235 public class Example { 236 public static void main(String[] args) { 237 ApiClient defaultClient = Configuration.getDefaultApiClient(); 238 defaultClient.setBasePath("/api/v1"); 239 240 // Configure HTTP basic authorization: basic_auth 241 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 242 basic_auth.setUsername("YOUR USERNAME"); 243 basic_auth.setPassword("YOUR PASSWORD"); 244 245 // Configure API key authorization: cookie_auth 246 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 247 cookie_auth.setApiKey("YOUR API KEY"); 248 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 249 //cookie_auth.setApiKeyPrefix("Token"); 250 251 // Configure API key authorization: oidc_auth 252 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 253 oidc_auth.setApiKey("YOUR API KEY"); 254 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 255 //oidc_auth.setApiKeyPrefix("Token"); 256 257 // Configure API key authorization: saml_auth 258 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 259 saml_auth.setApiKey("YOUR API KEY"); 260 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 261 //saml_auth.setApiKeyPrefix("Token"); 262 263 // Configure HTTP bearer authorization: jwt_token 264 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 265 jwt_token.setBearerToken("BEARER TOKEN"); 266 267 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 268 String repository = "repository_example"; // String | 269 String branch = "branch_example"; // String | 270 PathList pathList = new PathList(); // PathList | 271 Boolean force = false; // Boolean | 272 try { 273 ObjectErrorList result = apiInstance.deleteObjects(repository, branch, pathList) 274 .force(force) 275 .execute(); 276 System.out.println(result); 277 } catch (ApiException e) { 278 System.err.println("Exception when calling ObjectsApi#deleteObjects"); 279 System.err.println("Status code: " + e.getCode()); 280 System.err.println("Reason: " + e.getResponseBody()); 281 System.err.println("Response headers: " + e.getResponseHeaders()); 282 e.printStackTrace(); 283 } 284 } 285 } 286 ``` 287 288 ### Parameters 289 290 | Name | Type | Description | Notes | 291 |------------- | ------------- | ------------- | -------------| 292 | **repository** | **String**| | | 293 | **branch** | **String**| | | 294 | **pathList** | [**PathList**](PathList.md)| | | 295 | **force** | **Boolean**| | [optional] [default to false] | 296 297 ### Return type 298 299 [**ObjectErrorList**](ObjectErrorList.md) 300 301 ### Authorization 302 303 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 304 305 ### HTTP request headers 306 307 - **Content-Type**: application/json 308 - **Accept**: application/json 309 310 ### HTTP response details 311 | Status code | Description | Response headers | 312 |-------------|-------------|------------------| 313 | **200** | Delete objects response | - | 314 | **401** | Unauthorized | - | 315 | **403** | Forbidden | - | 316 | **404** | Resource Not Found | - | 317 | **420** | too many requests | - | 318 | **0** | Internal Server Error | - | 319 320 <a id="getObject"></a> 321 # **getObject** 322 > File getObject(repository, ref, path).range(range).ifNoneMatch(ifNoneMatch).presign(presign).execute(); 323 324 get object content 325 326 ### Example 327 ```java 328 // Import classes: 329 import io.lakefs.clients.sdk.ApiClient; 330 import io.lakefs.clients.sdk.ApiException; 331 import io.lakefs.clients.sdk.Configuration; 332 import io.lakefs.clients.sdk.auth.*; 333 import io.lakefs.clients.sdk.models.*; 334 import io.lakefs.clients.sdk.ObjectsApi; 335 336 public class Example { 337 public static void main(String[] args) { 338 ApiClient defaultClient = Configuration.getDefaultApiClient(); 339 defaultClient.setBasePath("/api/v1"); 340 341 // Configure HTTP basic authorization: basic_auth 342 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 343 basic_auth.setUsername("YOUR USERNAME"); 344 basic_auth.setPassword("YOUR PASSWORD"); 345 346 // Configure API key authorization: cookie_auth 347 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 348 cookie_auth.setApiKey("YOUR API KEY"); 349 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 350 //cookie_auth.setApiKeyPrefix("Token"); 351 352 // Configure API key authorization: oidc_auth 353 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 354 oidc_auth.setApiKey("YOUR API KEY"); 355 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 356 //oidc_auth.setApiKeyPrefix("Token"); 357 358 // Configure API key authorization: saml_auth 359 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 360 saml_auth.setApiKey("YOUR API KEY"); 361 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 362 //saml_auth.setApiKeyPrefix("Token"); 363 364 // Configure HTTP bearer authorization: jwt_token 365 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 366 jwt_token.setBearerToken("BEARER TOKEN"); 367 368 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 369 String repository = "repository_example"; // String | 370 String ref = "ref_example"; // String | a reference (could be either a branch or a commit ID) 371 String path = "path_example"; // String | relative to the ref 372 String range = "bytes=0-1023"; // String | Byte range to retrieve 373 String ifNoneMatch = "33a64df551425fcc55e4d42a148795d9f25f89d4"; // String | Returns response only if the object does not have a matching ETag 374 Boolean presign = true; // Boolean | 375 try { 376 File result = apiInstance.getObject(repository, ref, path) 377 .range(range) 378 .ifNoneMatch(ifNoneMatch) 379 .presign(presign) 380 .execute(); 381 System.out.println(result); 382 } catch (ApiException e) { 383 System.err.println("Exception when calling ObjectsApi#getObject"); 384 System.err.println("Status code: " + e.getCode()); 385 System.err.println("Reason: " + e.getResponseBody()); 386 System.err.println("Response headers: " + e.getResponseHeaders()); 387 e.printStackTrace(); 388 } 389 } 390 } 391 ``` 392 393 ### Parameters 394 395 | Name | Type | Description | Notes | 396 |------------- | ------------- | ------------- | -------------| 397 | **repository** | **String**| | | 398 | **ref** | **String**| a reference (could be either a branch or a commit ID) | | 399 | **path** | **String**| relative to the ref | | 400 | **range** | **String**| Byte range to retrieve | [optional] | 401 | **ifNoneMatch** | **String**| Returns response only if the object does not have a matching ETag | [optional] | 402 | **presign** | **Boolean**| | [optional] | 403 404 ### Return type 405 406 [**File**](File.md) 407 408 ### Authorization 409 410 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 411 412 ### HTTP request headers 413 414 - **Content-Type**: Not defined 415 - **Accept**: application/octet-stream, application/json 416 417 ### HTTP response details 418 | Status code | Description | Response headers | 419 |-------------|-------------|------------------| 420 | **200** | object content | * Content-Length - <br> * Last-Modified - <br> * ETag - <br> | 421 | **206** | partial object content | * Content-Length - <br> * Content-Range - <br> * Last-Modified - <br> * ETag - <br> | 422 | **302** | Redirect to a pre-signed URL for the object | * Location - redirect to S3 <br> | 423 | **304** | Content not modified | - | 424 | **401** | Unauthorized | - | 425 | **404** | Resource Not Found | - | 426 | **410** | object expired | - | 427 | **416** | Requested Range Not Satisfiable | - | 428 | **420** | too many requests | - | 429 | **0** | Internal Server Error | - | 430 431 <a id="getUnderlyingProperties"></a> 432 # **getUnderlyingProperties** 433 > UnderlyingObjectProperties getUnderlyingProperties(repository, ref, path).execute(); 434 435 get object properties on underlying storage 436 437 ### Example 438 ```java 439 // Import classes: 440 import io.lakefs.clients.sdk.ApiClient; 441 import io.lakefs.clients.sdk.ApiException; 442 import io.lakefs.clients.sdk.Configuration; 443 import io.lakefs.clients.sdk.auth.*; 444 import io.lakefs.clients.sdk.models.*; 445 import io.lakefs.clients.sdk.ObjectsApi; 446 447 public class Example { 448 public static void main(String[] args) { 449 ApiClient defaultClient = Configuration.getDefaultApiClient(); 450 defaultClient.setBasePath("/api/v1"); 451 452 // Configure HTTP basic authorization: basic_auth 453 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 454 basic_auth.setUsername("YOUR USERNAME"); 455 basic_auth.setPassword("YOUR PASSWORD"); 456 457 // Configure API key authorization: cookie_auth 458 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 459 cookie_auth.setApiKey("YOUR API KEY"); 460 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 461 //cookie_auth.setApiKeyPrefix("Token"); 462 463 // Configure API key authorization: oidc_auth 464 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 465 oidc_auth.setApiKey("YOUR API KEY"); 466 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 467 //oidc_auth.setApiKeyPrefix("Token"); 468 469 // Configure API key authorization: saml_auth 470 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 471 saml_auth.setApiKey("YOUR API KEY"); 472 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 473 //saml_auth.setApiKeyPrefix("Token"); 474 475 // Configure HTTP bearer authorization: jwt_token 476 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 477 jwt_token.setBearerToken("BEARER TOKEN"); 478 479 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 480 String repository = "repository_example"; // String | 481 String ref = "ref_example"; // String | a reference (could be either a branch or a commit ID) 482 String path = "path_example"; // String | relative to the branch 483 try { 484 UnderlyingObjectProperties result = apiInstance.getUnderlyingProperties(repository, ref, path) 485 .execute(); 486 System.out.println(result); 487 } catch (ApiException e) { 488 System.err.println("Exception when calling ObjectsApi#getUnderlyingProperties"); 489 System.err.println("Status code: " + e.getCode()); 490 System.err.println("Reason: " + e.getResponseBody()); 491 System.err.println("Response headers: " + e.getResponseHeaders()); 492 e.printStackTrace(); 493 } 494 } 495 } 496 ``` 497 498 ### Parameters 499 500 | Name | Type | Description | Notes | 501 |------------- | ------------- | ------------- | -------------| 502 | **repository** | **String**| | | 503 | **ref** | **String**| a reference (could be either a branch or a commit ID) | | 504 | **path** | **String**| relative to the branch | | 505 506 ### Return type 507 508 [**UnderlyingObjectProperties**](UnderlyingObjectProperties.md) 509 510 ### Authorization 511 512 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 513 514 ### HTTP request headers 515 516 - **Content-Type**: Not defined 517 - **Accept**: application/json 518 519 ### HTTP response details 520 | Status code | Description | Response headers | 521 |-------------|-------------|------------------| 522 | **200** | object metadata on underlying storage | - | 523 | **401** | Unauthorized | - | 524 | **404** | Resource Not Found | - | 525 | **420** | too many requests | - | 526 | **0** | Internal Server Error | - | 527 528 <a id="headObject"></a> 529 # **headObject** 530 > headObject(repository, ref, path).range(range).execute(); 531 532 check if object exists 533 534 ### Example 535 ```java 536 // Import classes: 537 import io.lakefs.clients.sdk.ApiClient; 538 import io.lakefs.clients.sdk.ApiException; 539 import io.lakefs.clients.sdk.Configuration; 540 import io.lakefs.clients.sdk.auth.*; 541 import io.lakefs.clients.sdk.models.*; 542 import io.lakefs.clients.sdk.ObjectsApi; 543 544 public class Example { 545 public static void main(String[] args) { 546 ApiClient defaultClient = Configuration.getDefaultApiClient(); 547 defaultClient.setBasePath("/api/v1"); 548 549 // Configure HTTP basic authorization: basic_auth 550 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 551 basic_auth.setUsername("YOUR USERNAME"); 552 basic_auth.setPassword("YOUR PASSWORD"); 553 554 // Configure API key authorization: cookie_auth 555 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 556 cookie_auth.setApiKey("YOUR API KEY"); 557 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 558 //cookie_auth.setApiKeyPrefix("Token"); 559 560 // Configure API key authorization: oidc_auth 561 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 562 oidc_auth.setApiKey("YOUR API KEY"); 563 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 564 //oidc_auth.setApiKeyPrefix("Token"); 565 566 // Configure API key authorization: saml_auth 567 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 568 saml_auth.setApiKey("YOUR API KEY"); 569 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 570 //saml_auth.setApiKeyPrefix("Token"); 571 572 // Configure HTTP bearer authorization: jwt_token 573 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 574 jwt_token.setBearerToken("BEARER TOKEN"); 575 576 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 577 String repository = "repository_example"; // String | 578 String ref = "ref_example"; // String | a reference (could be either a branch or a commit ID) 579 String path = "path_example"; // String | relative to the ref 580 String range = "bytes=0-1023"; // String | Byte range to retrieve 581 try { 582 apiInstance.headObject(repository, ref, path) 583 .range(range) 584 .execute(); 585 } catch (ApiException e) { 586 System.err.println("Exception when calling ObjectsApi#headObject"); 587 System.err.println("Status code: " + e.getCode()); 588 System.err.println("Reason: " + e.getResponseBody()); 589 System.err.println("Response headers: " + e.getResponseHeaders()); 590 e.printStackTrace(); 591 } 592 } 593 } 594 ``` 595 596 ### Parameters 597 598 | Name | Type | Description | Notes | 599 |------------- | ------------- | ------------- | -------------| 600 | **repository** | **String**| | | 601 | **ref** | **String**| a reference (could be either a branch or a commit ID) | | 602 | **path** | **String**| relative to the ref | | 603 | **range** | **String**| Byte range to retrieve | [optional] | 604 605 ### Return type 606 607 null (empty response body) 608 609 ### Authorization 610 611 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 612 613 ### HTTP request headers 614 615 - **Content-Type**: Not defined 616 - **Accept**: Not defined 617 618 ### HTTP response details 619 | Status code | Description | Response headers | 620 |-------------|-------------|------------------| 621 | **200** | object exists | * Content-Length - <br> * Last-Modified - <br> * ETag - <br> | 622 | **206** | partial object content info | * Content-Length - <br> * Content-Range - <br> * Last-Modified - <br> * ETag - <br> | 623 | **401** | Unauthorized | - | 624 | **404** | object not found | - | 625 | **410** | object expired | - | 626 | **416** | Requested Range Not Satisfiable | - | 627 | **420** | too many requests | - | 628 | **0** | internal server error | - | 629 630 <a id="listObjects"></a> 631 # **listObjects** 632 > ObjectStatsList listObjects(repository, ref).userMetadata(userMetadata).presign(presign).after(after).amount(amount).delimiter(delimiter).prefix(prefix).execute(); 633 634 list objects under a given prefix 635 636 ### Example 637 ```java 638 // Import classes: 639 import io.lakefs.clients.sdk.ApiClient; 640 import io.lakefs.clients.sdk.ApiException; 641 import io.lakefs.clients.sdk.Configuration; 642 import io.lakefs.clients.sdk.auth.*; 643 import io.lakefs.clients.sdk.models.*; 644 import io.lakefs.clients.sdk.ObjectsApi; 645 646 public class Example { 647 public static void main(String[] args) { 648 ApiClient defaultClient = Configuration.getDefaultApiClient(); 649 defaultClient.setBasePath("/api/v1"); 650 651 // Configure HTTP basic authorization: basic_auth 652 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 653 basic_auth.setUsername("YOUR USERNAME"); 654 basic_auth.setPassword("YOUR PASSWORD"); 655 656 // Configure API key authorization: cookie_auth 657 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 658 cookie_auth.setApiKey("YOUR API KEY"); 659 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 660 //cookie_auth.setApiKeyPrefix("Token"); 661 662 // Configure API key authorization: oidc_auth 663 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 664 oidc_auth.setApiKey("YOUR API KEY"); 665 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 666 //oidc_auth.setApiKeyPrefix("Token"); 667 668 // Configure API key authorization: saml_auth 669 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 670 saml_auth.setApiKey("YOUR API KEY"); 671 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 672 //saml_auth.setApiKeyPrefix("Token"); 673 674 // Configure HTTP bearer authorization: jwt_token 675 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 676 jwt_token.setBearerToken("BEARER TOKEN"); 677 678 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 679 String repository = "repository_example"; // String | 680 String ref = "ref_example"; // String | a reference (could be either a branch or a commit ID) 681 Boolean userMetadata = true; // Boolean | 682 Boolean presign = true; // Boolean | 683 String after = "after_example"; // String | return items after this value 684 Integer amount = 100; // Integer | how many items to return 685 String delimiter = "delimiter_example"; // String | delimiter used to group common prefixes by 686 String prefix = "prefix_example"; // String | return items prefixed with this value 687 try { 688 ObjectStatsList result = apiInstance.listObjects(repository, ref) 689 .userMetadata(userMetadata) 690 .presign(presign) 691 .after(after) 692 .amount(amount) 693 .delimiter(delimiter) 694 .prefix(prefix) 695 .execute(); 696 System.out.println(result); 697 } catch (ApiException e) { 698 System.err.println("Exception when calling ObjectsApi#listObjects"); 699 System.err.println("Status code: " + e.getCode()); 700 System.err.println("Reason: " + e.getResponseBody()); 701 System.err.println("Response headers: " + e.getResponseHeaders()); 702 e.printStackTrace(); 703 } 704 } 705 } 706 ``` 707 708 ### Parameters 709 710 | Name | Type | Description | Notes | 711 |------------- | ------------- | ------------- | -------------| 712 | **repository** | **String**| | | 713 | **ref** | **String**| a reference (could be either a branch or a commit ID) | | 714 | **userMetadata** | **Boolean**| | [optional] [default to true] | 715 | **presign** | **Boolean**| | [optional] | 716 | **after** | **String**| return items after this value | [optional] | 717 | **amount** | **Integer**| how many items to return | [optional] [default to 100] | 718 | **delimiter** | **String**| delimiter used to group common prefixes by | [optional] | 719 | **prefix** | **String**| return items prefixed with this value | [optional] | 720 721 ### Return type 722 723 [**ObjectStatsList**](ObjectStatsList.md) 724 725 ### Authorization 726 727 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 728 729 ### HTTP request headers 730 731 - **Content-Type**: Not defined 732 - **Accept**: application/json 733 734 ### HTTP response details 735 | Status code | Description | Response headers | 736 |-------------|-------------|------------------| 737 | **200** | object listing | - | 738 | **401** | Unauthorized | - | 739 | **404** | Resource Not Found | - | 740 | **420** | too many requests | - | 741 | **0** | Internal Server Error | - | 742 743 <a id="statObject"></a> 744 # **statObject** 745 > ObjectStats statObject(repository, ref, path).userMetadata(userMetadata).presign(presign).execute(); 746 747 get object metadata 748 749 ### Example 750 ```java 751 // Import classes: 752 import io.lakefs.clients.sdk.ApiClient; 753 import io.lakefs.clients.sdk.ApiException; 754 import io.lakefs.clients.sdk.Configuration; 755 import io.lakefs.clients.sdk.auth.*; 756 import io.lakefs.clients.sdk.models.*; 757 import io.lakefs.clients.sdk.ObjectsApi; 758 759 public class Example { 760 public static void main(String[] args) { 761 ApiClient defaultClient = Configuration.getDefaultApiClient(); 762 defaultClient.setBasePath("/api/v1"); 763 764 // Configure HTTP basic authorization: basic_auth 765 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 766 basic_auth.setUsername("YOUR USERNAME"); 767 basic_auth.setPassword("YOUR PASSWORD"); 768 769 // Configure API key authorization: cookie_auth 770 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 771 cookie_auth.setApiKey("YOUR API KEY"); 772 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 773 //cookie_auth.setApiKeyPrefix("Token"); 774 775 // Configure API key authorization: oidc_auth 776 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 777 oidc_auth.setApiKey("YOUR API KEY"); 778 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 779 //oidc_auth.setApiKeyPrefix("Token"); 780 781 // Configure API key authorization: saml_auth 782 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 783 saml_auth.setApiKey("YOUR API KEY"); 784 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 785 //saml_auth.setApiKeyPrefix("Token"); 786 787 // Configure HTTP bearer authorization: jwt_token 788 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 789 jwt_token.setBearerToken("BEARER TOKEN"); 790 791 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 792 String repository = "repository_example"; // String | 793 String ref = "ref_example"; // String | a reference (could be either a branch or a commit ID) 794 String path = "path_example"; // String | relative to the branch 795 Boolean userMetadata = true; // Boolean | 796 Boolean presign = true; // Boolean | 797 try { 798 ObjectStats result = apiInstance.statObject(repository, ref, path) 799 .userMetadata(userMetadata) 800 .presign(presign) 801 .execute(); 802 System.out.println(result); 803 } catch (ApiException e) { 804 System.err.println("Exception when calling ObjectsApi#statObject"); 805 System.err.println("Status code: " + e.getCode()); 806 System.err.println("Reason: " + e.getResponseBody()); 807 System.err.println("Response headers: " + e.getResponseHeaders()); 808 e.printStackTrace(); 809 } 810 } 811 } 812 ``` 813 814 ### Parameters 815 816 | Name | Type | Description | Notes | 817 |------------- | ------------- | ------------- | -------------| 818 | **repository** | **String**| | | 819 | **ref** | **String**| a reference (could be either a branch or a commit ID) | | 820 | **path** | **String**| relative to the branch | | 821 | **userMetadata** | **Boolean**| | [optional] [default to true] | 822 | **presign** | **Boolean**| | [optional] | 823 824 ### Return type 825 826 [**ObjectStats**](ObjectStats.md) 827 828 ### Authorization 829 830 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 831 832 ### HTTP request headers 833 834 - **Content-Type**: Not defined 835 - **Accept**: application/json 836 837 ### HTTP response details 838 | Status code | Description | Response headers | 839 |-------------|-------------|------------------| 840 | **200** | object metadata | - | 841 | **401** | Unauthorized | - | 842 | **404** | Resource Not Found | - | 843 | **400** | Bad Request | - | 844 | **410** | object gone (but partial metadata may be available) | - | 845 | **420** | too many requests | - | 846 | **0** | Internal Server Error | - | 847 848 <a id="uploadObject"></a> 849 # **uploadObject** 850 > ObjectStats uploadObject(repository, branch, path).ifNoneMatch(ifNoneMatch).storageClass(storageClass).force(force).content(content).execute(); 851 852 853 854 ### Example 855 ```java 856 // Import classes: 857 import io.lakefs.clients.sdk.ApiClient; 858 import io.lakefs.clients.sdk.ApiException; 859 import io.lakefs.clients.sdk.Configuration; 860 import io.lakefs.clients.sdk.auth.*; 861 import io.lakefs.clients.sdk.models.*; 862 import io.lakefs.clients.sdk.ObjectsApi; 863 864 public class Example { 865 public static void main(String[] args) { 866 ApiClient defaultClient = Configuration.getDefaultApiClient(); 867 defaultClient.setBasePath("/api/v1"); 868 869 // Configure HTTP basic authorization: basic_auth 870 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 871 basic_auth.setUsername("YOUR USERNAME"); 872 basic_auth.setPassword("YOUR PASSWORD"); 873 874 // Configure API key authorization: cookie_auth 875 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 876 cookie_auth.setApiKey("YOUR API KEY"); 877 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 878 //cookie_auth.setApiKeyPrefix("Token"); 879 880 // Configure API key authorization: oidc_auth 881 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 882 oidc_auth.setApiKey("YOUR API KEY"); 883 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 884 //oidc_auth.setApiKeyPrefix("Token"); 885 886 // Configure API key authorization: saml_auth 887 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 888 saml_auth.setApiKey("YOUR API KEY"); 889 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 890 //saml_auth.setApiKeyPrefix("Token"); 891 892 // Configure HTTP bearer authorization: jwt_token 893 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 894 jwt_token.setBearerToken("BEARER TOKEN"); 895 896 ObjectsApi apiInstance = new ObjectsApi(defaultClient); 897 String repository = "repository_example"; // String | 898 String branch = "branch_example"; // String | 899 String path = "path_example"; // String | relative to the branch 900 String ifNoneMatch = "*"; // String | Set to \"*\" to atomically allow the upload only if the key has no object yet. Other values are not supported. 901 String storageClass = "storageClass_example"; // String | Deprecated, this capability will not be supported in future releases. 902 Boolean force = false; // Boolean | 903 File content = new File("/path/to/file"); // File | Only a single file per upload which must be named \\\"content\\\". 904 try { 905 ObjectStats result = apiInstance.uploadObject(repository, branch, path) 906 .ifNoneMatch(ifNoneMatch) 907 .storageClass(storageClass) 908 .force(force) 909 .content(content) 910 .execute(); 911 System.out.println(result); 912 } catch (ApiException e) { 913 System.err.println("Exception when calling ObjectsApi#uploadObject"); 914 System.err.println("Status code: " + e.getCode()); 915 System.err.println("Reason: " + e.getResponseBody()); 916 System.err.println("Response headers: " + e.getResponseHeaders()); 917 e.printStackTrace(); 918 } 919 } 920 } 921 ``` 922 923 ### Parameters 924 925 | Name | Type | Description | Notes | 926 |------------- | ------------- | ------------- | -------------| 927 | **repository** | **String**| | | 928 | **branch** | **String**| | | 929 | **path** | **String**| relative to the branch | | 930 | **ifNoneMatch** | **String**| Set to \"*\" to atomically allow the upload only if the key has no object yet. Other values are not supported. | [optional] | 931 | **storageClass** | **String**| Deprecated, this capability will not be supported in future releases. | [optional] | 932 | **force** | **Boolean**| | [optional] [default to false] | 933 | **content** | **File**| Only a single file per upload which must be named \\\"content\\\". | [optional] | 934 935 ### Return type 936 937 [**ObjectStats**](ObjectStats.md) 938 939 ### Authorization 940 941 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 942 943 ### HTTP request headers 944 945 - **Content-Type**: multipart/form-data, application/octet-stream 946 - **Accept**: application/json 947 948 ### HTTP response details 949 | Status code | Description | Response headers | 950 |-------------|-------------|------------------| 951 | **201** | object metadata | - | 952 | **400** | Validation Error | - | 953 | **401** | Unauthorized | - | 954 | **403** | Forbidden | - | 955 | **404** | Resource Not Found | - | 956 | **412** | Precondition Failed | - | 957 | **420** | too many requests | - | 958 | **0** | Internal Server Error | - | 959