Asset Media - Rotate Asset

This guide explains how to rotate an asset in EnterMediaDB using:

  • JSON REST API
  • EnterMediaDB API UI

Both methods perform the same operation.


1. Overview

The Rotate Asset API allows you to rotate an existing asset by a specified number of degrees.

This process updates the asset’s orientation based on the provided rotation value.


2. API Endpoint

The API endpoint is the URL used to run this operation via the REST API.

Endpoint:

POST /assets/mediadb/services/module/asset/media/rotateasset

This endpoint:

  • Processes a rotation request
  • Applies the specified rotation to the given asset

3. Required Parameters

The following parameters must be included in the request body:

  • assetid: ID of the asset to rotate
  • rotate: Degrees to rotate the asset (e.g., 90, 180, 270)

These values specify which asset to modify and how it should be rotated.


4. Rotate Asset Using JSON REST API

Step 1: Prepare Your Data

Example:

{
  "assetid": "101",
  "rotate": "90"
}

Step 2: Send the Request
curl -H "Content-Type: application/json" \
  -X POST http://entermedia.org/assets/mediadb/services/module/asset/media/rotateasset \
  -b "entermedia.key=YOUR_SESSION_KEY" \
  -d '{
    "assetid": "101",
    "rotate": "90"
  }'
Notes
  • Replace YOUR_SESSION_KEY with your actual entermedia.key
  • Ensure your API session is initialized (see Authentication section)
  • Use -L if your server redirects to HTTPS

5. Rotate Asset Using EnterMediaDB API UI

You can rotate an asset directly in the EnterMediaDB interface.

Steps
  1. Open the EnterMediaDB API UI

    Example:
    https://emedialibrary.org/mediadb

  2. In the left sidebar, navigate to:
    Asset MediaRotate Asset

  3. In the request editor, enter:

{
  "assetid": "101",
  "rotate": "90"
}

4. Click Execute


6. Response

A successful request returns:

{
  "response": {
    "status": "ok",
    "height": 200,
    "width": 133
  }
}

7. What Happens After Rotation

After a successful request:

  • The asset is rotated by the specified number of degrees
  • The updated dimensions (height and width) are returned
  • The asset is saved with the new orientation

8. Troubleshooting

1. Rotation fails
  • Check that assetid is valid
  • Ensure rotate value is supported (e.g., 90, 180, 270)
  • Verify API permissions are enabled

2. Unauthorized request
  • Ensure entermedia.key is included
  • Ensure session is initialized
  • Verify permissions

3. No visible change
  • Refresh the asset in the UI
  • Confirm the correct asset was targeted
  • Verify the rotation value was applied correctly