Docs | imagemash.io
DashboardSign up for Free
  • 🎉imagemash.io
  • 🚀Getting Started
    • Simple CDN Link Usage
  • 💽Sources
    • IM Cloud Storage
    • Image URL
    • Storage Providers
      • Amazon S3
      • Google Cloud
      • S3 Compatible Storage
    • Web Folder
  • 🖼️Image Transform
    • Transform Options
      • Quality
      • Width
      • Height
      • Scale
      • Crop
      • Gravity
      • Background
      • Border
      • Round
      • Output Format
      • Angle (Rotate)
      • Flip
      • Helpers
        • x, y
      • Filters
        • Tint
        • Flatten
        • Grayscale
        • Blur
        • Sharpen
        • Median
        • Threshold
        • Negative
    • Transform Cheat Sheet
    • Named Transforms
  • 🛠️API
    • API - Good to knows
    • API Methods
      • Account
        • Named Transforms
          • Get named transforms
          • Add named transform
          • Remove named transform
        • Image URL Restriction
          • Get keyword list
          • Add keyword to list
          • Remove keyword from list
          • Change keyword list usage
      • Storage
        • Upload file
        • Get and search files
        • Delete files
        • Add new tags to files
        • Set tags of files
        • Remove tags from files
        • Purge Cache
      • Optimize / Transform
  • ❓How it works?
    • Custom Domain
    • Bandwidth
    • Cloud Storage
    • Caching
    • Purge Cache
    • Limits
  • Contact Us
Powered by GitBook
On this page
  1. API
  2. API Methods
  3. Account
  4. Named Transforms

Add named transform

PreviousGet named transformsNextRemove named transform

Last updated 2 years ago

Adds a new named transform

POST https://api.imagemash.io/v1/account/addNamedTransform

Headers

Name
Type
Description

apikey*

Your API Key

Request Body

Name
Type
Description

shortcut*

String

Shortcut name of your named transform. Eg. big_logo, my_named_transform

transformString*

String

Actual transform string. Look for for valid transform strings. Eg. w_100,h_100,bo_2_skyblue

// Empty Body
{
    msg: "error details"
    details: "..."
}   // Explanation of error
Unauthorized

Example Codes

curl --request POST \
  --url https://api.imagemash.io/v1/account/addNamedTransform \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'apikey: your_api_key' \
  --data shortcut=my_named_transform \
  --data 'transformString=w_100,h_100,bo_2_skyblue'
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://api.imagemash.io/v1/account/addNamedTransform"),
    Headers =
    {
        { "apikey", "your_api_key" },
    },
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "shortcut", "my_named_transform" },
        { "transformString", "w_100,h_100,bo_2_skyblue" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "shortcut=my_named_transform&transformString=w_100%2Ch_100%2Cbo_2_skyblue");
Request request = new Request.Builder()
  .url("https://api.imagemash.io/v1/account/addNamedTransform")
  .post(body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("apikey", "your_api_key")
  .build();

Response response = client.newCall(request).execute();
var axios = require("axios").default;

var options = {
  method: 'POST',
  url: 'https://api.imagemash.io/v1/account/addNamedTransform',
  headers: {'Content-Type': 'application/x-www-form-urlencoded', apikey: 'your_api_key'},
  data: {shortcut: 'my_named_transform', transformString: 'w_100,h_100,bo_2_skyblue'}
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});
import requests

url = "https://api.imagemash.io/v1/account/addNamedTransform"

payload = "shortcut=my_named_transform&transformString=w_100%2Ch_100%2Cbo_2_skyblue"
headers = {
    "Content-Type": "application/x-www-form-urlencoded",
    "apikey": "your_api_key"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.imagemash.io/v1/account/addNamedTransform")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request["apikey"] = 'your_api_key'
request.body = "shortcut=my_named_transform&transformString=w_100%2Ch_100%2Cbo_2_skyblue"

response = http.request(request)
puts response.read_body
🛠️
Transform Options