Checking a Bucket
You can check if a bucket is already created.
Execute the API as follows to check if a bucket exists.
In the application scope
curl -v -X HEAD \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
"https://api-jp.kii.com/api/apps/{APP_ID}/buckets/{BUCKET_ID}"
In a group scope
curl -v -X HEAD \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
"https://api-jp.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}/buckets/{BUCKET_ID}"
In a user scope
curl -v -X HEAD \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
"https://api-jp.kii.com/api/apps/{APP_ID}/users/me/buckets/{BUCKET_ID}"
In a thing scope
curl -v -X HEAD \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
"https://api-jp.kii.com/api/apps/{APP_ID}/things/{THING_ID}/buckets/{BUCKET_ID}"
For all cases, Kii Cloud returns one of the following responses:
- A 204 response if the bucket exists.
- A 404 response if the bucket does not exist.
- A 401 response if the user does not have the access privilege to the bucket.