群暉 PhotoStation API 資料和代碼

群暉的NAS一直口碑都不錯榛了,主要是安全性和功能都比較完善,可玩性比較高煞抬。最近在學(xué)Python霜大,就想著拿PhotoStation的API來練練手,看看能不能搗鼓出一些新的功能來革答。

結(jié)果上網(wǎng)這么一查战坤,沒想到群暉竟然沒有提供官方的API文檔(倒是提供了File Station API Guide)真是讓人大跌眼鏡,是擔(dān)心被玩壞呢還是怎么想残拐。好不容易從其他地方找到了一些資料途茫,這里給大家做下分享,也是拋磚引玉溪食,如果有人找到官方的API囊卜,也請留言,多謝。

1栅组、API接口

接口API主要由以下5個基本要素組成

  • API name: Name of the API requested
  • version: Version of the API requested
  • path: path of the API. The path information can be retrieved by requesting SYNO.API.Info
  • method: Method of the API requested
  • _sid: Authorized session ID. Each API request should pass it, which is retrieved from the
    response of /webapi/auth.cgi, via either HTTP/HTTPS GET/POST method with “_sid”
    argument. Otherwise, if you pass it within “id” value of cookie of HTTP/HTTPS header, this
    parameter can be ignored.

語法

GET /webapi/<CGI_PATH>?api=<API_NAME>&version=<VERSION>&method=<METHOD>[&<PARAMS>][&_sid=<SID>]

例子

http://myds.com:port/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=all

API name: SYNO.API.Info
version: 1
path: query.cgi
method: query
params: query=all

調(diào)用步驟


API Workflow

PhotoStation API 列表

{
        "SYNO.PhotoStation.Auth": {
                "path": "auth.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["login", "logout", "checkauth"]
                }
        },
        "SYNO.PhotoStation.Info": {
                "path": "info.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["getinfo"]
                }
        },
        "SYNO.PhotoStation.Album": {
                "path": "album.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["list", "getinfo", "create", "edit", "delete", "arrangeitem", "move", "cleararrangeitem", "cancel"]
                }
        },
        "SYNO.PhotoStation.Permission": {
                "path": "permission.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["getalbum", "editalbum", "editgroup", "list_public_share", "edit_public_share"]
                }
        },
    "SYNO.PhotoStation.Photo": {
        "path": "photo.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "listexif", "listfeatureditem", "listgpsgroup", "listgpsgroupeditem", "getinfo", "getexif", "edit", "delete", "copy", "cancel"]
        }
    },
    "SYNO.PhotoStation.Thumb": {
        "path": "thumb.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["get", "get_dsm_thumb"]
        }
    },
        "SYNO.PhotoStation.Cover": {
        "path": "cover.php",
        "minVersion": 1,
        "maxVersion": 2,
        "methods": {
            "1": ["set"],
            "2": ["set","setsmart"]
        }
    },
        "SYNO.PhotoStation.SmartAlbum": {
        "path": "smart_album.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "getinfo", "create", "edit", "delete"]
        }
    },
    "SYNO.PhotoStation.File": {
        "path": "file.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["uploadphoto", "uploadvideo"]
        }
    },
    "SYNO.PhotoStation.Download": {
        "path": "download.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["getphoto", "getvideo", "getitem"]
        }
    },
        "SYNO.PhotoStation.Category": {
                "path": "category.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["list", "getinfo", "create", "edit", "delete", "arrangecategory", "listitem", "additem", "removeitem", "arrangeitem"]
                }
        },
    "SYNO.PhotoStation.About": {
        "path": "about.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["get", "set", "set_visibility"]
        }
    },
    "SYNO.PhotoStation.Tag": {
        "path": "tag.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "getinfo", "create", "edit", "delete", "searchplace", "delete_unconfirmed_tag"]
        }
    },
    "SYNO.PhotoStation.PhotoTag": {
        "path": "photo_tag.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "people_tag", "geo_tag", "desc_tag", "delete", "people_tag_confirm"]
        }
    },
    "SYNO.PhotoStation.Comment": {
        "path": "comment.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "create", "delete"]
        }
    },
    "SYNO.PhotoStation.Timeline": {
        "path": "timeline.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["getindex"]
        }
    },
    "SYNO.PhotoStation.Group": {
        "path": "group.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "get", "get_dsm_group", "getmember", "create", "edit", "editmember", "delete"]
        }
    },
        "SYNO.PhotoStation.Rotate": {
                "path": "rotate.php",
                "minVersion": 1,
                "maxVersion": 1,
                "methods": {
                        "1": ["set"]
                }
        },
    "SYNO.PhotoStation.SlideshowMusic": {
        "path": "slideshow_music.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "get", "add", "edit", "delete"]
        }
    },
    "SYNO.PhotoStation.DsmShare": {
        "path": "dsm_share.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "copy", "copymusic"]
        }
    },
    "SYNO.PhotoStation.SharedAlbum": {
        "path": "shared_album.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "getinfo", "getinfo_public", "create", "edit", "delete", "add_items", "remove_items", "edit_public_share", "get_single_item", "set_single_item"]
        }
    },
    "SYNO.PhotoStation.PhotoLog": {
        "path": "log.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list", "clear", "export"]
        }
    },
    "SYNO.PhotoStation.Path": {
        "path": "path.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["getpath", "checkpath"]
        }
    },
    "SYNO.PhotoStation.Watermark": {
        "path": "watermark.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["getshare", "listshare", "upload", "copy", "delete", "remove"]
        }
    },
    "SYNO.PhotoStation.Public": {
        "path": "public.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["list"]
        }
    },
    "SYNO.PhotoStation.Migration": {
        "path": "migration.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["export_blog"]
        }
    },
    "SYNO.PhotoStation.ACL": {
        "path": "acl.php",
        "minVersion": 1,
        "maxVersion": 1,
        "methods": {
            "1": ["get", "set"]
        }
    }
}
2雀瓢、開源Python 項目(一個芬蘭人寫的)

https://github.com/skarppi/python-photostation
https://pypi.org/project/photostation/
用法也很簡單,不過作者實(shí)現(xiàn)的功能也不多玉掸,主要就是對照片的元數(shù)據(jù)進(jìn)行修改之類刃麸。
具體就不多說了,大家可以上github上下代碼看看

3司浪、API 可以用來做什么
  • 給照片或者視頻批量打標(biāo)簽泊业、評分、修改日期等等
  • 批量上傳圖片和視頻
  • 其他還可以做什么啊易,需要開下腦洞
4吁伺、參考資料

論壇
官方文檔下載地址

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市认罩,隨后出現(xiàn)的幾起案子箱蝠,更是在濱河造成了極大的恐慌,老刑警劉巖垦垂,帶你破解...
    沈念sama閱讀 206,602評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件宦搬,死亡現(xiàn)場離奇詭異,居然都是意外死亡劫拗,警方通過查閱死者的電腦和手機(jī)间校,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,442評論 2 382
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來页慷,“玉大人憔足,你說我怎么就攤上這事【品保” “怎么了滓彰?”我有些...
    開封第一講書人閱讀 152,878評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長州袒。 經(jīng)常有香客問我揭绑,道長,這世上最難降的妖魔是什么郎哭? 我笑而不...
    開封第一講書人閱讀 55,306評論 1 279
  • 正文 為了忘掉前任他匪,我火速辦了婚禮,結(jié)果婚禮上夸研,老公的妹妹穿的比我還像新娘邦蜜。我一直安慰自己,他們只是感情好亥至,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,330評論 5 373
  • 文/花漫 我一把揭開白布悼沈。 她就那樣靜靜地躺著贱迟,像睡著了一般。 火紅的嫁衣襯著肌膚如雪井辆。 梳的紋絲不亂的頭發(fā)上关筒,一...
    開封第一講書人閱讀 49,071評論 1 285
  • 那天,我揣著相機(jī)與錄音杯缺,去河邊找鬼蒸播。 笑死,一個胖子當(dāng)著我的面吹牛萍肆,可吹牛的內(nèi)容都是我干的袍榆。 我是一名探鬼主播,決...
    沈念sama閱讀 38,382評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼塘揣,長吁一口氣:“原來是場噩夢啊……” “哼包雀!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起亲铡,我...
    開封第一講書人閱讀 37,006評論 0 259
  • 序言:老撾萬榮一對情侶失蹤才写,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后奖蔓,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體赞草,經(jīng)...
    沈念sama閱讀 43,512評論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,965評論 2 325
  • 正文 我和宋清朗相戀三年吆鹤,在試婚紗的時候發(fā)現(xiàn)自己被綠了厨疙。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,094評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡疑务,死狀恐怖沾凄,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情知允,我是刑警寧澤撒蟀,帶...
    沈念sama閱讀 33,732評論 4 323
  • 正文 年R本政府宣布,位于F島的核電站温鸽,受9級特大地震影響保屯,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜嗤朴,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,283評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望虫溜。 院中可真熱鬧雹姊,春花似錦、人聲如沸衡楞。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,286評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至歧杏,卻和暖如春镰惦,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背犬绒。 一陣腳步聲響...
    開封第一講書人閱讀 31,512評論 1 262
  • 我被黑心中介騙來泰國打工旺入, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人凯力。 一個月前我還...
    沈念sama閱讀 45,536評論 2 354
  • 正文 我出身青樓茵瘾,卻偏偏與公主長得像,于是被迫代替她去往敵國和親咐鹤。 傳聞我的和親對象是個殘疾皇子拗秘,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,828評論 2 345

推薦閱讀更多精彩內(nèi)容