Difficulty Creating Buckets in Apache Ozone via REST API #6619
-
Dear Apache Ozone Community, I hope this message finds you well. I am reaching out to share a challenge I am facing while attempting to create buckets in Apache Ozone using the REST API. Specifically, I have been trying to create a new bucket within a volume using Python and the requests library to interact with the Apache Ozone REST API. However, despite following the documentation and guidelines available, I have encountered difficulties in successfully creating buckets. python Apache Ozone Recon API base URLOZONE_API_URL = "http://########:9888/api/v1" Volume namevolume_name = "vol1" Bucket name to be creatednew_bucket_name = "new_bucket" Endpoint for creating a bucket in a volumeendpoint = f"{OZONE_API_URL}/volume/{volume_name}/bucket/{new_bucket_name}" Send a PUT request to create the bucketresponse = requests.put(endpoint) Check if the bucket was created successfullyif response.status_code == 200: I would greatly appreciate any insights, guidance, or assistance that the community can provide to help resolve this issue. Additionally, if there are any specific configurations or permissions that need to be set up in Apache Ozone to enable bucket creation via the API, I would be grateful for any instructions or recommendations in this regard. Thank you very much for your attention and support. I look forward to hearing from you and resolving this issue together. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi Faheem, it looks like you are trying to create a bucket via Recon. This is not supposed to work because Ozone Recon (and its API) only provides Ozone cluster status but not file system read/write operations. More details on Recon APIs: https://ozone.apache.org/docs/current/interface/reconapi.html You should use Ozone S3 Gateway for this purpose instead, please check its documentation here: https://ozone.apache.org/docs/current/interface/s3.html |
Beta Was this translation helpful? Give feedback.
-
Use 3 backticks like this
edit your initial post to try it , It should looks like import requests
# Apache Ozone Recon API base URL
OZONE_API_URL = "http://########:9888/api/v1"
# Volume name
volume_name = "vol1"
# Bucket name to be created
new_bucket_name = "new_bucket" |
Beta Was this translation helpful? Give feedback.
Hi Faheem, it looks like you are trying to create a bucket via Recon. This is not supposed to work because Ozone Recon (and its API) only provides Ozone cluster status but not file system read/write operations. More details on Recon APIs: https://ozone.apache.org/docs/current/interface/reconapi.html
You should use Ozone S3 Gateway for this purpose instead, please check its documentation here: https://ozone.apache.org/docs/current/interface/s3.html