Schogini API Documentation

Overview

API Base URL: https://do.schogini.com:8084/api/

This API provides endpoints for checking connections, manipulating images, and universal module requests.

Authentication

Method: Bearer Token

Header: Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123

Endpoints

Check Connection

Endpoint: /check

Method: GET

Description: Verifies the connection using an API key.

Request Headers:

Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123

Response:

200 OK:

{
    "connection_name": "sree@example.com"
}

401 Unauthorized:

{
    "connection_name": "invalid"
}

Select a Random URL

Endpoint: /random_element_make

Method: POST

Description: Selects a random URL from the provided list of URLs.

Request Headers:

x-api-key: 123e4567-e89b-12d3-a456-426614174000

Request Parameters:

{
  "urls": [
    "my_url_1.html",
    "my_url_2.html",
    "my_url_3.html"
  ]
}

Response:

200 OK:

"body":"{\"selected_url\":\"value1\"}"

401 Unauthorized:

{
    "connection_name": "invalid"
}

422 Unprocessable Entity:

{
    "error": "Unable to process image."
}

Perform API Call to Schogini Image Wizard

Endpoint: /universal-make

Method: POST (or PUT, PATCH as needed)

Description: Forwards the request to a target URL using custom headers and parameters.

Request Headers:

x-api-key: 123e4567-e89b-12d3-a456-426614174000

Request Parameters:

{
  "url": "random_element_make",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "urls": ["value1", "value2"]
  }
}

Response:

200 OK:

{
    "status_code": 200,
    "headers": {
        "date": "Thu, 05 Sep 2024 19:39:34 GMT",
        "server": "uvicorn",
        "content-type": "application/json"
    },
    "body": "{\"selected_url\":\"value1\"}"
}

Rotate an Image

Endpoint: /image-rotate

Method: POST

Description: Rotates the given image by the specified degrees.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "degrees": 90
}

Response:


Binary image data with the "filename" header set to "rotated_.png"
            

Add Watermark to an Image

Endpoint: /image-watermark

Method: POST

Description: Adds a watermark to the given image at the specified position and opacity.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "watermark_url": "https://example.com/watermark.png",
  "opacity": 50,
  "position_x": 50,
  "position_y": 50
}

Response:


Binary image data with the "filename" header set to "watermarked_.png"
            

Crop an Image

Endpoint: /image-crop

Method: POST

Description: Crops the given image based on the specified top-left and bottom-right coordinates.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "top_left_x": 10,
  "top_left_y": 10,
  "bottom_right_x": 90,
  "bottom_right_y": 90
}

Response:


Binary image data with the "filename" header set to "cropped_.png"
            

Resize an Image

Endpoint: /resize_image

Method: POST

Description: Resizes the given image to the specified width while maintaining aspect ratio.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "output_format": "png",
  "width": 800,
  "image_as_url": false
}

Response:


Binary image data with the "filename" header set to "resized_.png"
            

Generate Image Thumbnail

Endpoint: /image-thumbnail

Method: POST

Description: Generates a thumbnail from the provided image URL based on the maximum width and height.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "max_width": 150,
  "max_height": 150
}

Response:


Binary image data with the "filename" header set to "thumbnail_.png"
            

Blur an Image

Endpoint: /image-blur

Method: POST

Description: Applies a blur effect to the provided image URL based on the specified blur radius.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "blur_radius": 5
}

Response:


Binary image data with the "filename" header set to "blurred_.png"
            

Convert Image to Greyscale

Endpoint: /image-grayscale

Method: POST

Description: Converts the provided image to greyscale.

Request Parameters:

{
  "image_url": "https://example.com/image.png"
}

Response:


Binary image data with the "filename" header set to "grayscale_.png"
            

Convert Image Format

Endpoint: /image-format-convert

Method: POST

Description: Converts the image to the specified format (e.g., JPEG, PNG).

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "target_format": "jpeg"
}

Response:


Binary image data with the "filename" header set to "image_."
    

Get Image Metadata

Endpoint: /image-info-metadata

Method: POST

Description: Retrieves metadata about the image, such as size, format, and mode.

Request Parameters:

{
  "image_url": "https://example.com/image.png"
}

Response:

{
  "status": "success",
  "image_size_bytes": 10240,
  "image_width": 800,
  "image_height": 600,
  "image_format": "PNG",
  "image_mode": "RGBA"
}

Add Border to an Image

Endpoint: /image-border

Method: POST

Description: Adds a border of specified thickness and color to the image.

Request Parameters:

{
  "image_url": "https://example.com/image.png",
  "border_thickness": 10,
  "border_color": "#FF0000"
}

Response:


Binary image data with the "filename" header set to "image_.png"
    

Convert SVG to PNG

Endpoint: /svg-reader

Method: POST

Description: Converts an SVG file from the provided URL into a PNG image.

Request Parameters:

{
  "svg_url": "https://example.com/image.svg"
}

Response:


Binary image data with the "filename" header set to "image_.png"
    

Read a QR Code

Endpoint: /qrcode-reader

Method: POST

Description: Reads and decodes a QR code from an image URL, returning the text value encoded in the QR code.

Request Parameters:

{
  "qrcode_url": "https://example.com/qrcode.png"
}

Response:

{
  "value": "Decoded text from the QR code"
}

Generate a QR Code

Endpoint: /qrcode

Method: POST

Description: Generates a QR code image based on the provided text input.

Request Parameters:

{
  "text_input": "This is a sample QR code text"
}

Response:


Binary image data with the "filename" header set to "qrcode_.png"
            

Glue Images Together

Endpoint: /stick_image

Method: POST

Description: Sticks one image onto another at a specified position and size, based on percentage values.

Request Parameters:

{
  "image_url_1": "https://example.com/image1.png",
  "image_url_2": "https://example.com/image2.png",
  "width_percentage": 50,
  "left_percentage": 25,
  "top_percentage": 10
}

Response:


Binary image data with the "filename" header set to "stick_image_.png"
            

Example Requests

Check Connection:

curl -X GET "https://do.schogini.com:8084/api/check" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000"

Select a Random URL:

curl -X POST "https://do.schogini.com:8084/api/random_element_make" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-d '{
  "urls": [
    "my_url_1.html",
    "my_url_2.html",
    "my_url_3.html"
  ]
}'

Perform API Call to Schogini Image Wizard:

curl -X POST "https://do.schogini.com:8084/api/universal-make" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-d '{
  "url": "random_element_make",
  "method": "POST",
  "headers": {"Content-Type": "application/json"},
  "body": {"urls": ["value1", "value2"]}
}'

Generate Image Thumbnail:

curl -X POST "https://do.schogini.com:8084/api/image-thumbnail" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png",
  "max_width": 150,
  "max_height": 150
}'

Blur an Image:

curl -X POST "https://do.schogini.com:8084/api/image-blur" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png",
  "blur_radius": 5
}'

Convert Image to Greyscale:

curl -X POST "https://do.schogini.com:8084/api/image-grayscale" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png"
}'

Convert Image Format:

curl -X POST "https://do.schogini.com:8084/api/image-format-convert" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png",
  "target_format": "jpeg"
}'

Get Image Metadata:

curl -X POST "https://do.schogini.com:8084/api/image-info-metadata" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png"
}'

Add Border to Image:

curl -X POST "https://do.schogini.com:8084/api/image-border" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "image_url": "https://example.com/image.png",
  "border_thickness": 10,
  "border_color": "#FF0000"
}'

Convert SVG to PNG:

curl -X POST "https://do.schogini.com:8084/api/svg-reader" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174123" \
-H "Content-Type: application/json" \
-d '{
  "svg_url": "https://example.com/image.svg"
}'

Read a QR Code:

curl -X POST "https://do.schogini.com:8084/api/qrcode-reader" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-d '{
  "qrcode_url": "https://example.com/qrcode.png"
}'

Generate QR Code:

curl -X POST "https://do.schogini.com:8084/api/qrcode" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-d '{
  "text_input": "This is a sample QR code text"
}'

Glue Images Together:

curl -X POST "https://do.schogini.com:8084/api/stick_image" \
-H "Authorization: Bearer 123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-d '{
  "image_url_1": "https://example.com/image1.png",
  "image_url_2": "https://example.com/image2.png",
  "width_percentage": 50,
  "left_percentage": 25,
  "top_percentage": 10
}'