API v1

# API v1

Anh.Moe API v1 cho phép mọi người sử dụng api để upload lên website.

# API key

Khoá API v1 của Anh.Moe là : anh.moe_public_api

Để dùng api riêng vui lòng đăng ký tài khoản và truy cập vào cài đặt để lấy :
https://anh.moe/settings/api

# API call

#Phương thức yêu cầu (Request method)

Các lệnh gọi API v1 có thể được thực hiện bằng cách sử dụng các phương thức yêu cầu POST hoặc GET nhưng vì yêu cầu GET bị giới hạn bởi độ dài tối đa cho phép của một URL, vì vậy bạn nên sử dụng phương thức yêu cầu POST hơn.

# Request URL

https://anh.moe/api/1/upload/

#Thông số (Parameters)

# Ví dụ về cách gọi API

GET https://anh.moe/api/1/upload/?key=anh.moe_public_api&source=FILES["source"]&format=json

Lưu ý: Luôn sử dụng POST khi upload file trực tiếp từ trên máy. Url encoding có thể thay đổi nguồn base64 do các ký tự được mã hóa hoặc chỉ do giới hạn độ dài yêu cầu URL do yêu cầu GET.

# API response

API v1 responses will vary depending on the format parameter:

Khi sử dụng JSON, phản hồi sẽ có mã trạng thái tiêu đề để cho phép bạn dễ dàng nhận biết nếu yêu cầu đã OK hay không. Nó cũng sẽ xuất ra thuộc tính status_txtstatus_code.

# Ví dụ về phản hồi (JSON)

{
    "status_code": 200,
    "success": {
        "message": "image uploaded",
        "code": 200
    },
    "image": {
        "name": "example",
        "extension": "png",
        "size": 53237,
        "width": 1151,
        "height": 898,
        "date": "2014-06-04 15:32:33",
        "date_gmt": "2014-06-04 19:32:33",
        "storage_id": null,
        "description": null,
        "nsfw": "0",
        "md5": "c684350d722c956c362ab70299735830",
        "storage": "datefolder",
        "original_filename": "example.png",
        "original_exifdata": null,
        "views": "0",
        "id_encoded": "L",
        "filename": "example.png",
        "ratio": 1.2817371937639,
        "size_formatted": "52 KB",
        "mime": "image/png",
        "bits": 8,
        "channels": null,
        "url": "http://127.0.0.1/images/2014/06/04/example.png",
        "url_viewer": "http://127.0.0.1/image/L",
        "thumb": {
            "filename": "example.th.png",
            "name": "example.th",
            "width": 160,
            "height": 160,
            "ratio": 1,
            "size": 17848,
            "size_formatted": "17.4 KB",
            "mime": "image/png",
            "extension": "png",
            "bits": 8,
            "channels": null,
            "url": "http://127.0.0.1/images/2014/06/04/example.th.png"
        },
        "medium": {
            "filename": "example.md.png",
            "name": "example.md",
            "width": 500,
            "height": 390,
            "ratio": 1.2820512820513,
            "size": 104448,
            "size_formatted": "102 KB",
            "mime": "image/png",
            "extension": "png",
            "bits": 8,
            "channels": null,
            "url": "http://127.0.0.1/images/2014/06/04/example.md.png"
        },
        "views_label": "views",
        "display_url": "http://127.0.0.1/images/2014/06/04/example.md.png",
        "how_long_ago": "moments ago"
    },
    "status_txt": "OK"
}

# Ví dụ về phản hồi (txt)

http://127.0.0.1/images/2014/06/04/example.png
Customize upload by clicking on any preview
Customize upload by touching on any preview
يتم تحميل 0 files (0% أكتمل)
يجري الآن تحميل القائمة، سوف يستغرق عدة ثواني للإنتهاء.
تم الرفع
تمت إضافة المحتوى الذي تم تحميله إلى . يمكنك create new خانة فارغة مع المحتوى الذي تم تحميله للتو.
تمت إضافة المحتوى الذي تم تحميله إلى .
يمكنك create new خانة فارغة مع المحتوى الذي تم تحميله للتو. You must إنشاء حساب or تسجيل الدخول to save this content into your account.
لا file تم تحميلها
Some errors have occurred and the system couldn't process your request.
    أو إلغاءإلغاء ما تبقى
    Note: Some files couldn't be uploaded. إعرف المزيد
    تحقق من تقرير الخطأللمزيد من المعلومات