Java asset management

When using Cloudinary, all your images, videos, and other raw files are uploaded to your Cloudinar account. You can browse and manage your uploaded media assets and generated transitions using our media library web interface. Additionally, you can use methods in the Upload and Admin APIs, which provide methods for managing, organizing, and creating media assets.
The upload API method can be used as needed.
Management API methods are rate limited.
You can view the number of Admin API requests per hour allowed for your account plan in the account page of the console settings.

Upload API
In addition to the upload method, this API also includes the following methods:
Rename and permanently delete individual assets
Add tags, contextual metadata and structured metadata to assets
Create new assets such as text images, archives (zip or tgz) and sprite
modifications existing assets.

Management API
A secure API with methods to manage and organize media assets, including:
List and restore assets
Mass asset deletion
Manage upload presets, upload maps, transforms and folders
Update existing
assets Perform advanced searches on assets in your account
Generate account usage reports
and more. . .
 

Upload API Example - Deleting a Single Asset
The following Java example uses the Upload API destroy method to delete a video with a public ID example from a Cloudinary account:

Map config = ObjectUtils.asMap(
  "cloud_name", "my_cloud_name",
  "api_key", "my_api_key",
  "api_secret", "my_api_secret");
Cloudinary cloudinary = new Cloudinary(config);
Map result = cloudinary.uploader().destroy("sample",
  ObjectUtils.asMap("resource_type","video"));

Example output:

{
  "result": "ok"
}

Tip: To delete multiple assets, use the Admin API deleteResources method.

For more Upload API examples in Java, select the Java tab in the Upload API Reference.
Admin API Example - Get Details of a Single Asset
The following Java example uses the Admin API resource method to return the details of an image with a public ID example:

Map config = ObjectUtils.asMap(
  "cloud_name", "my_cloud_name",
  "api_key", "my_api_key",
  "api_secret", "my_api_secret");
Cloudinary cloudinary = new Cloudinary(config);
Map result = cloudinary.api().resource("sample", ObjectUtils.emptyMap());

Example output:

{
  "asset_id": "d86882d7788f5d1d702cb63418f082a6",
  "public_id": "sample",
  "format": "jpg",
  "version": 1312461204,
  "resource_type": "image",
  "type": "upload",
  "created_at": "2017-08-04T12:33:24Z",
  "bytes": 120253,
  "width": 864,
  "height": 576,
  "url": "http://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg",
  "secure_url": "https://.../image/upload/v1312461204/sample.jpg",
  "next_cursor": "041a39fc10971b9eabd4993470f6bfaf",
  "derived": [
    {
      "transformation": "c_fill,w_100,h_100",
      "format": "jpg",
      "bytes": 7112,
      "id": "8267a869b62a93a59248f35d7f124c1f",
      "url": "http://.../demo/image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg",
      "secure_url": "https://.../image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg"
    },
    {
      "transformation": "w_230,h_168,c_fit",
      "format": "jpg",
      "bytes": 19173,
      "id": "383e22a57167445552a3cdc16f0a0c85",
      "url": "http://.../demo/image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg",
      "secure_url": "https://.../image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg"
    }
  ]
 }

For more Admin API examples in Java, select the Java tab in the Admin API Reference.

Guess you like

Origin blog.csdn.net/std7879/article/details/127781660