PIXELHUE
us English
  • us English
  • 简体中文
    PIXELHUE
    us English
    • us English
    • 简体中文
    • API User Guide
    • 1 Authentication
      • 1.1 User Login
        POST
      • 1.2 Read Node Public Information
        GET
    • 2 Device
      • 2.1 Read Node Information
        GET
      • 2.2 Factory Reset
        PUT
      • 2.3 Set Transition Effect
        PUT
      • 2.4 Set Swap
        PUT
      • 2.5 Read Node Monitoring Status
        GET
    • 3 Connector
      • 3.1 Read Connector Details
        GET
      • 3.2 Set Output Mapping
        PUT
      • 3.3 Set Image Quality
        PUT
    • 4 Screen
      • 4.1 v1
        • 4.1.1 FTB
        • 4.1.2 Freeze
        • 4.1.3 Take
        • 4.1.4 Cut
      • 4.2 v2
        • 4.2.1 Retrieve Screen Information
        • 4.2.2 Freeze
        • 4.2.3 FTB
        • 4.2.4 Cut
        • 4.2.5 Take
    • 5 Layer
      • 5.1 Retrieve Layer Information
        GET
      • 5.2 Retrieve Layer Templates
        GET
      • 5.3 Apply Layer Templates
        PUT
      • 5.4 Set Layer Source
        PUT
      • 5.5 Select Layer
        PUT
    • 6. Preset
      • 6.1 v1
        • 6.1.1 Edit Preset
        • 6.1.2 Save Preset
        • 6.1.3 Load Preset
      • 6.2 v2
        • 6.2.1 Retrieve Preset Details
        • 6.2.2 Create Preset
        • 6.2.3 Load Preset
        • 6.2.4 Rename Preset
        • 6.2.5 Delete Preset
    • 7 Gallery
      • 7.1 Retrieve Image Details
        GET
    • 数据模型
      • Schemas
      • Root

    API User Guide

    VersionDescriptionDateRemarks
    V1.0.0Initial version2025-04-30
    V2.0.01. Added specific logic for screen designation, removed screen selection logic. 2. Added complete presets and relative presets. 3. Added interface module protocol. 4. Added layer module protocol. 5. Added gallery module protocol. 6. Screen section 4.1/Preset section 6.1 adapt to devices below version 1.7.0. 7. Screen section 4.2/ Preset section 6.2 adapt to devices version 1.7.0 and above.2025-07-28Device range (P10, P20, Q8)
    V2.0.11. Added the supported device model P80.2025-10-14Supported devices (P10, P20, Q8,P80)

    1 Environment Setup#

    When calling the relevant APIs, ensure the following environment:
    Ensure the PC communicates properly with the device.

    2 Basic Usage Steps#

    Open the corresponding API call tool.
    Find the interface information required for use.
    Call the relevant APIs according to the interface protocol.

    3 Request Method Description#

    3.1 Call Format#

    All API requests must be made in the following format.
    Protocol call prefix: http://ip:port/pixelhue/+protocol url (ip: device address, port: 8088)
    For example: http://10.40.41.226:8088/pixelhue/v1/node/open-detail
    The following information must be filled in the HTTP header:
    1.
    Authorization: token information
    image.png
    Token generation method
    1.
    Call node information interface (no need to carry token)
    URL: http://ip:port/pixelhue/v1/node/open-detail
    Method:get
    Query:
    {
        "nodeId": 1
    }
    Response:
    {
        "code": 0,
        "message": "ok",
        "data": {
            "sn": "1231231042541226",
            "startTime": "1718282915976"    }
    }
    2.
    Client generates token
    var Secret = []byte("whatasecret")  //The client obtains the service start time as the key by calling the newly added node information interface from the UServer.
    
    // JWT expiration time, set according to the actual environment
    const expiration = 2 * time.Minute
    
    type Claims struct {
        // Custom fields can include username, user ID, user role, etc.
        SN string
        // jwt.StandardClaims includes the officially defined fields
        jwt.StandardClaims
    }
    
    func GetToken(SN string) (string, error) {
        // Create declaration
        a := &Claims{
            SN:  (sn value returned by the open-detail interface),
            StandardClaims: jwt.StandardClaims{
                ExpiresAt: time.Now().Add(expiration).Unix(), // Expiration time
                IssuedAt:  time.Now().Unix(),                 // Issuance time
                Issuer:    "gin-jwt-demo",                    // Issuer
                Id:        "",                                // Select this as needed, in some implementations, this ID is controlled to determine whether it is still valid based on black/white list.
                NotBefore: 0,                                 // Start time in effect
                Subject:   "",                                // Subject
            },
        }
        // Create a signature object using the specified hash method
        tt := jwt.NewWithClaims(jwt.SigningMethodHS256, a)
        return tt.SignedString(Secret)
    }

    3.2 Call Example#

    **GET request **
    Take retrieving node information as an example:
    1.
    Open the API call tool.
    image.png
    2.
    Locate the relevant API interface, construct the URL using the IP and port, change the request method to a GET request, and call the interface to retrieve the result.
    企业微信截图_17442883898911.png
    PUT/POST Request
    Taking setting layer Z-order as an example:
    1.
    After opening the API tool, change the request method to a PUT request, construct the URL based on the IP and port, construct the necessary JSON data, send the interface information, and check if it was successfully sent.
    企业微信截图_17442883561629.png
    DELETE Request
    Taking layer deletion as an example:
    1.
    After opening the API tool, change the request method to DELETE. Construct the URL based on the IP and port, build the required JSON data, send the interface information, and check whether it was successfully sent.
    企业微信截图_17442884117018.png

    4 Error Code#

    Error CodeFieldDescription
    0successSuccess
    Non-0failedFailure
    修改于 2025-12-04 10:02:51
    下一页
    1.1 User Login
    Built with