---
# System prepended metadata

title: API list

---

# API list
![image](https://hackmd.io/_uploads/S1T-206Ra.png)


## introduce
* signin
    * purpose: sign in
    * request type：post
    * url：http://{domain}/signin
    * reuslt：
        * success：{
                "code":1,
                "status":"success",
                "excpetion":""
            }
        * fail(not in the user list)：{
                "code":0,
                "status":"fail",
                "excpetion":"need sign up"
            } 
        * fail(the other error)：{
                "code":0,
                "status":"fail",
                "excpetion":"{excption}"
            }
    * parameter:
    

| parameter| type   | description| must | example |
| ------------------- | ------ | --------------------------------------------- | ---- | -------------------------------- |
| userid| string | tg userid | Y    | '12133131313'|

    example：
    1、curl -X POST "http://{domain}/signin" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad"}'
    2、curl -X POST "http://{domain}/signin" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad"}'



* signup
    * * purpose: user signup
    * request type：post
    * url：http://{domain}/signup
    * reuslt：
        * success：{"message": "User created successfully"}
        * fail：exception
    * parameter:
    

| parameter           | type   | description                                   | must | example                              |
| ------------------- | ------ | --------------------------------------------- | ---- | ------------------------------------ |
|  userid | string  |tg  userid|  Y | '12311311'                  |
| username            | string | tg username                                   | N    | 'dadadad'                            |
| addedinvitationlink | string | invitation link from the other(should be md5) | N    | "25bb515c5d2ed527dc91de76d9e34862"   |
| USDTWalletAddress   | string | the USDTWalletAddress of the user             | Y    | "TK9sJdqHZNQv4dfRfJ2aAp7af9uYwnxxkY" |


    example：
    1、curl -X POST "http://{domain}/signup" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad"}'
    2、curl -X POST "http://{domain}/signup" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad", "addedinvitationlink": "25bb515c5d2ed527dc91de76d9e34862"}'
     
     
* getinvitationlink
    * purpose: get invitation link of the user and then it can be shared to the other.
    * request type：post
    * url：http://{domain}/getinvitationlink
    * reuslt：
        * success：{"invitationlink": "dfafafgafadfawd"}
        * fail：exception
    * parameter:
    

| parameter| type   | description| must | example |
| ------------------- | ------ | --------------------------------------------- | ---- | -------------------------------- |
| userid| string | tg userid | Y    | '21313131'|



    example：
    1、curl -X POST "http://{domain}/getinvitationlink" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad"}'
    2、curl -X POST "http://{domain}/getinvitationlink" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad", "addedinvitationlink": "25bb515c5d2ed527dc91de76d9e34862"}'
     
* getranking
    * request type：post
    * url：http://{domain}/getranking
    * reuslt：
        * success：{"username": username, "result": {
                            "first_layer_links_nb":len(first_layer_links),
                            "first_layer_links": first_layer_links,
                            "total_referrals": total_referrals,
                            "all_related": all_related_links_nb,
                        }
                   }
            * first_layer_links_nb-->int, 圖片中referrals的5(第一層的user account的個數)
            * first_layer_links-->list of string, 圖片中列出第一層的user account
            * total_referrals-->int, 圖片中327(第一層加到第六層的人數)
            * all_related-->int, 圖片中10000(matrix中1排到12階的人數)
    ![messageImage_1710421991791](https://hackmd.io/_uploads/Hy0au7MRT.jpg)
                  
        * fail：exception
    * parameter:
    

| parameter |type     | description| must | example |
| --- | --- | -------- | -------- | -------- |
|userid  |string     |tg userid          |  Y        |'12313131'  |

    example：
    1、curl -X POST "http://{domain}/getranking" \
     -H "Content-Type: application/json" \
     -d '{"username": "dadadad"}'


* Record Userid and Invitationlink
    * purpose: record Userid and Invitationlink in db
    * request type：post
    * url：http://{domain}/RecordUseridInvitationlink
    * reuslt：
        * success：{
                "code":1,
                "status":"success",
                "excpetion":""
            }
        * fail：{
                "code":0,
                "status":"fail",
                "excpetion":"{exception}"
            } 
    * parameter:
    

| parameter | type   | description | must | example    |
| --------- | ------ | ----------- | ---- | ---------- |
| userid    | string | tg userid   | Y    | '21313131' |
| addedinvitationlink | string | addedinvitationlink   | N    | 'd103a1d32aw1d3aw1d3' |



    example：
    1、curl -X POST "http://{domain}/RecordUseridInvitationlink" \
     -H "Content-Type: application/json" \
     -d '{"userid": "dadadad", "addedinvitationlink":"111d34a13d"}'


* search Userid and Invitationlink
    * purpose: search Userid and Invitationlink in db
    * request type：post
    * url：http://{domain}/SearchUseridInvitationlink
    * reuslt：
        * success：{
                "code":1,
                "result":"dadfafafafafd",
                "status":"success",
                "excpetion":""
            }
        * fail：{
                "code":0,
                "result":'',
                "status":"fail",
                "excpetion":"{exception}"
            }
    * parameter:
    

| parameter | type   | description | must | example    |
| --------- | ------ | ----------- | ---- | ---------- |
| userid    | string | tg userid   | Y    | '21313131' |


    example：
    1、curl -X POST "http://{domain}/SearchUseridInvitationlink" \
     -H "Content-Type: application/json" \
     -d '{"userid": "132313131"}'