# Recommendation

## <mark style="color:blue;">GET</mark> /api/v1/recommend

* Note: The recommendation engine recommends potential friends to users based on whom they follow on twitter, users' on-chain transactions on the Ethereum blockchain, the NFTs they hold, and whom they are following at this moment.
* Header

| Field         | Type   | Remarks                                                                                                  |
| ------------- | ------ | -------------------------------------------------------------------------------------------------------- |
| ApiKey        | String | [ApiKey](https://relationlabs.gitbook.io/relation-one-api/guide/glossary#apikey) acquired from the admin |
| Authorization | String | Bearer ${unifiedAuthToken} , in which the unifiedAuthToken is the result returned by /api/v1/auth        |

* Request Parameters

| Field  | Type   | Remarks                                                                                            |
| ------ | ------ | -------------------------------------------------------------------------------------------------- |
| limit  | int    | Query limit (up to 100)                                                                            |
| cursor | string | Cursor data returned by last page. If it is empty, it means the caller is querying the first page. |

* Request Example

```shell
curl GET 'https://api.relationlabs.ai/api/v1/recommend?cursor=a604fdd8e80142dfaf07af11096d5150&limit=10' \
--header 'Authorization: Bearer ey1JhbGciOiJFUzI1NiJ9.eyJqdGkiOiIyYzAzYTMwZGY4NjY0Mjk5OWZlMDcwODhh1MzVhNGU0YiIsImlzcyI6InJlbGF0aW9ubGFicy5haSIsImlhdCI6MTY2MTQwNTQxOSwic3ViIjoiYmFmMzQta2lhYWEtYWFhYWstYWNnamEtY2FpIiwiZXhwIjoxNjYyMDEwMjE5fQ.1EVbUxmtVCm6aEVZtEAji1KuCM1dsZEOMExcYvT-GdKrHRQ1qzyghXsNZSdSDUAwoSe9jGV48_1zdi2Rlrylw3Q' \
--header 'ApiKey: <ApiKey>'
```

* Response Parameters

| Field | Type              | Remarks            |
| ----- | ----------------- | ------------------ |
| code  | String            | the Return Code    |
| desc  | String            | the Return Message |
| data  | RecommendResponse | the Data           |

The RecommendResponse field consists of the following subfields:

| Field  | Type                 | Remarks           |
| ------ | -------------------- | ----------------- |
| cursor | String               | the cursor        |
| list   | List\[RecommendUser] | list of followers |

The RecommendUser field consists of the following subfields:

| Field           | Type    | Remarks                                                                                                                        |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| relationId      | String  | User's relationId                                                                                                              |
| name            | String  | User name                                                                                                                      |
| avatar          | String  | User's avatar                                                                                                                  |
| recommendReason | String  | Reason for recommendation:Following on twitterCounterparty on ethereumHolder of ${nft name}Followed by ${followingUser's name} |
| following       | boolean | Following or not: true for following; false for not                                                                            |

* Response Body

```json
{
    "code": "0",
    "desc": "success",
    "data": {
        "cursor": "a8728c5910a04c94b70e18694d72cbb0",
        "list": [
            {
                "relationId": "aoafg-eqaaa-aaaaj-afena-cai",
                "name": "test_user",
                "avatar": "https://3fypb-gqaaa-aaaag-aaedq-cai.ic1.io/avatar/nft/eth/0xed5af388653567af2f388e6224dc7c4b3241c544/1.jpg",
                "recommendReason": "Holder of Azuki",
                "following": false
            },
            ...
        ]
    }
}
```

* Return Code

| code | desc    | Remarks                           |
| ---- | ------- | --------------------------------- |
| 0    | success | the flag for a successful request |
