AopAop Node Open APIs

The node (tentative name) module of the app supports the following APIs and JSON data formats.
Just use your favorite programming language to implement the following APIs, handle the submitted parameters or form data, and then return the data in the corresponding format to drive the functionality page ofthe app's node module.

  1. Download image/file (URL of the image or file)
    Method: GET
    Param:
    No Param
    Return binary data stream
  2. Get Node Metadata (/)
    Method: GET
    Param:
    No Param
    Return JSON:
    {"ver": "v1","name": "Node1","icon": "img/icon.webp","cover": "img/cover.webp","pageSize": 20,"watermark": {"path": "img/watermark.webp","offsetX": 10,"offsetY": 10,"position": 2},"editInterval": 7776000 }
  3. Get News List (/v1/list/{$page})
    Method: GET
    Param:
    int {$page}=1, 2, etc.
    Return JSON:
    [{"id": 1,"title": "title1","timestamp": 1748224265,"views": 70,"comments": 99,"likes": 1000,"nickname": "nickname1","cover": "0.webp"}]
    If Empty, Return JSON:
    []
  4. Get News (/v1/news/{$news_id})
    Method: GET
    Param:
    int {$news_id}=1, 2, etc.
    Return JSON:
    {"id":1,"content":"content1","images":["0.webp","8.webp"],"avatar":"avatar1.webp"}
  5. Is Admin? (/v1/isadmin/{$user_id}/{$session_id})
    Method: GET
    Param:
    int {$user_id}=1, 2, etc.
    String {$session_id}
    Return JSON (boolean, 1=true, 0=false):
    {"r":1}
  6. Is Like? (/v1/islike/{$user_id}/{$session_id}/{$news_id})
    Method: GET
    Param:
    int {$user_id}=1, 2, etc.
    String {$session_id}
    int {$news_id}=1, 2, etc.
    Return JSON (boolean, 1=true, 0=false):
    {"r":0}
  7. Post Like (/v1/like)
    Method: POST
    Form Field:
    uid (User ID: 1, 2, etc.)
    sid (Session ID: String)
    id (News ID: 1, 2, etc.)
    Return JSON (boolean, 1=added, 0=cancelled):
    {"r":1}
  8. Post News (/v1/postnews)
    Method: POST
    MultipartBody Form Field:
    uid (User ID: 1, 2, etc.)
    sid (Session ID: String)
    id (News ID: 0, 1, 2, etc.; 0 for add, >0 for edit;)
    title (String, Optional, if the id > 0 and this field has not changed)
    content (String, Optional, if the id > 0 and this field has not changed)
    images[] (File Array, Optional, if the id = 0 or (id > 0 and this field has not changed); If the filename is a number, it means this is a new image, otherwise, it means the image has not changed;)
    Return JSON (The newly inserted news ID or the posted news ID):
    {"id":1}
  9. Delete News (/v1/delnews)
    Method: POST
    Form Field:
    uid (User ID: 1, 2, etc.)
    sid (Session ID: String)
    id (News ID: 1, 2, etc.)
    Return JSON (boolean, 1=success, 0=undefined failure):
    {"r":1}
  10. Sign In (/v1/signin)
    Method: POST
    MultipartBody Form Field:
    uid (User ID: 0, 1, 2, etc.; 0 for add, >0 for edit;)
    sid (Session ID: String)
    nickname (String, Optional, if the field is empty)
    avatar (File, Optional, if the field is empty)
    hash (String, Optional, if the field is empty)
    Return JSON (The newly inserted user ID or the posted user ID):
    {"id":1}
  11. Post Nickname (/v1/postnickname)
    Method: POST
    Form Field:
    uid (User ID: 1, 2, etc.)
    sid (Session ID: String)
    nickname (String)
    Return JSON (boolean, 1=success, 0=undefined failure, -1=change restricted, -2=nickname duplicated):
    {"r":1}
  12. Post Avatar (/v1/postavatar)
    Method: POST
    MultipartBody Form Field:
    uid (User ID: 1, 2, etc.)
    sid (Session ID: String)
    avatar (File)
    hash (String)
    Return JSON (boolean, 1=success, 0=undefined failure, -1=change restricted, -2=changed nothing):
    {"r":1}

Changelog

AopAop Node Open APIs 0.1.0 Release

Jun 07, 2025
First public release;