hiper-backend
    hiper-backend
    • API Conventions
    • user
      • before login
        • login
        • register a user
        • request verification code
        • reset email
        • reset password
      • search users
        GET
      • get the user
        GET
      • get current user
        GET
      • update current user
        PATCH
    • game
      • create
        • create a game
      • administer
        • get settings related info about the game
        • update the game's game logic
        • update the game's match detail
      • get games
        GET
    • contest
      • create
        • create a contest
      • administer
        • get settings related info about the contest
        • update the registration password
      • get contests
        GET
      • register for contest
        PUT
      • exit contest
        DELETE
    • permission
      • grant creation permission
        PUT
      • revoke creation permission
        DELETE
    • base contest
      • administer
        • delete the game
        • add admin
        • relinquish admin
        • update contest script
        • update metadata
        • add a sdk
        • get a sdk
        • delete a sdk
        • update a sdk
        • update states
      • get the game
        GET
      • get AIs
        GET
      • commit an AI
        POST
      • get the ai
        GET
      • download the AI
        GET
      • edit ai note
        PUT
      • get contestants
        GET
      • assign an AI
        PUT
      • get current contestant
        GET
      • revoke the assigned AI
        DELETE
      • get matches
        GET
      • get a match
        GET
      • get sdks
        GET

    API Conventions

    团队内部注:强烈建议「接口显示为URL」而非「接口显示为名称」。

    Data Schemas#

    Schemas first. Then define APIs based on schemas.
    Current schemas naming:
    <xxx>: list <xxx>s.
    <xxx_base>: only necessary fields
    <xxx_detail>: list one <xxx> detailedly
    Avoid null if [], "" are enough, to keep a singular type. Use null only when necessary, for example when the integer value doesn't exist and it's reasonable not to omit it.
    For all string values, there should be a length limit. Similarly, there should be a size limit on file value.

    API URL#

    By default, use plural.
    Singular: 0 or 1, exists or not. Like "current user".

    API Responce#

    success#

    Return data directly.
    Only use HTTP status code 200.
    Separate retrieval of simple JSON data and relatively big data. What "relatively big data" means:
    1.
    Files. Except small text content, if suitable.
    2.
    Data that needs explicit sort/limit etc.

    error#

    Use HTTP status codes first to make a satisfying classification.
    400, 401, 403, 404, 422.
    500
    For convenience, some obvious responce can be omitted in docs, like 401, 403, 404 in many cases.
    If status codes are not concrete enough, add code item to clarify, which is a concise and human-readable string enum.
    If needed, more items like detail(string) can be added for convenience in debugging.
    The above compose an error object. If there are more than one errors, return the first one.
    Next
    login
    Built with