# Discover Recommended Communities

## Discover Communities

<mark style="color:blue;">`GET`</mark> `https://api.whisk.com/community/v2/discover`

You can append the following query parameters to the base URL to pull recommended communities:

#### Query Parameters

| Name   | Type  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------ | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fields | array | <p>Any additional community details to retrieve. You can choose one or more of these supported values:<br>- <code>COMMUNITY\_FIELD\_DESCRIPTION</code><br>- <code>COMMUNITY\_FIELD\_TOPICS</code><br>- <code>COMMUNITY\_FIELD\_SOCIAL\_SETTINGS</code><br>- <code>COMMUNITY\_FIELD\_PERMISSIONS</code><br>- <code>COMMUNITY\_FIELD\_MEMBERS\_COUNT</code><br>- <code>COMMUNITY\_FIELD\_RECIPES\_COUNT</code><br>- <code>COMMUNITY\_FIELD\_SPONSORED</code><br><br><strong>Note</strong>: For performance reasons, we recommend using this parameter only when required.</p> |

#### Headers

| Name           | Type   | Description                                                                      |
| -------------- | ------ | -------------------------------------------------------------------------------- |
| Authentication | string | User token to authorize the API usage. For more information, see Authentication. |

{% tabs %}
{% tab title="200 This is how a successful response looks." %}

```graphql
{
  "topics": [
    {
      "details": {
        "id": "string",
        "display_name": "string"
      },
      "community_ids": [
        "string"
      ],
      "has_more_communities": true
    }
  ],
  "communities": [
    {
      "id": "string",
      "name": "string",
      "image": {
        "url": "string",
        "width": 0,
        "height": 0,
        "selection": {
          "x": 0,
          "y": 0,
          "width": 0,
          "height": 0
        }
      },
      "description": "string",
      "topics": [
        {
          "id": "string",
          "display_name": "string"
        }
      ],
      "social_settings": {
        "website_url": "string",
        "instagram_username": "string",
        "youtube_channel_url": "string",
        "tiktok_username": "string"
      },
      "permissions": {
        "role": "COMMUNITY_ROLE_INVALID",
        "mode": "COMMUNITY_CONTRIBUTION_PERMISSION_MODE_INVALID",
        "visibility": "COMMUNITY_VISIBILITY_INVALID"
      },
      "members": {
        "count": 0
      },
      "recipes": {
        "count": 0
      },
      "is_sponsored": true
    }
  ]
}
```

{% endtab %}

{% tab title="400 This failed response appears when error codes are found in the endpoint query." %}

```yaml
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
```

{% endtab %}

{% tab title="401 This failed response appears due to API authentication failure. The possible error codes that may appear are:auth.tokenNotFound, auth.tokenExpired, auth.tokenInvalid, auth.tokenRequired." %}

```yaml
{
  "code": "auth.tokenNotFound"
}
```

{% endtab %}

{% tab title="500 This failed response appears when something is not right on Whisk's end. Please send a message to <help@whisk.com>, and be sure to include both the Request and Response data. We’ll get back to you soon." %}

```yaml
This is unexpected response, something is wrong on our side, please contact: help@whisk.com
```

{% endtab %}
{% endtabs %}

### Sample Request and Response

{% tabs %}
{% tab title="Curl Request" %}

```bash
curl -X GET "https://api.whisk.com/community/v2/discover?fields=COMMUNITY_FIELD_DESCRIPTION&fields=COMMUNITY_FIELD_TOPICS&fields=COMMUNITY_FIELD_SOCIAL_SETTINGS&fields=COMMUNITY_FIELD_PERMISSIONS&fields=COMMUNITY_FIELD_MEMBERS_COUNT&fields=COMMUNITY_FIELD_RECIPES_COUNT&fields=COMMUNITY_FIELD_SPONSORED"
    -H "Accept: application/json"
    -H "Authorization: Bearer <YOUR-API-ACCESS-KEY>"
```

{% hint style="info" %}
**Note**: Whisk allows you to discover and understand its API capabilities on the Swagger interface with the ability to try out the API calls directly in your browser. You can call this endpoint [here](https://api.whisk.com/spec/#/CommunityAPI/CommunityAPI_DiscoverCommunities).
{% endhint %}
{% endtab %}

{% tab title="Response" %}

```graphql
"topics": [
    {
      "details": {
        "id": "69f7f66c4c774fcf90ba4d5762f06517",
        "display_name": "Featured Communities"
      },
      "community_ids": [
        "2a6b5e672ce84f50a9a25e6d73f82a90",
        "d25506c2690f4b81b2050b9b90bda3b7",
        ...
      ]
    },
    {
      "details": {
        "id": "2539c69a099940ed865d7e0cce2fb1d8",
        "display_name": "Creators on Whisk"
      },
      "community_ids": [
        ...
      ]
    },
    {
      "details": {
        "id": "2caf6d4719c7492f83c70ce58fd475c1",
        "display_name": "Quick & Simple"
      },
      "community_ids": [
        ...
      ],
      "has_more_communities": true
    },
    ...
  ],
  "communities": [
    {
      "id": "2a6b5e672ce84f50a9a25e6d73f82a90",
      "name": "Everyday Healthy",
      "image": {
        ...
      },
      "description": "Mains, sides, dinners, starters - these are the everyday recipes that are healthy without sacrificing flavor. ",
      "topics": [
        ...
      ],
      "permissions": {
        ...
      },
      "members": {
        "count": 28610
      },
      "recipes": {
        "count": 342
      }
    },
    {
      "id": "d25506c2690f4b81b2050b9b90bda3b7",
      "name": "Instant pot fans",
      ...
    },
    {
      "id": "3bc908c1c797426a84c89ed84770108e",
      "name": "Mediterranean Diet",
      ...
    },
    ...
  ]
}
```

The first part of the response includes the list of topics and the recommended communities within those topics. The second part includes details of each recommended community.&#x20;

{% hint style="info" %}
**Note**: To understand the data structure of a community definition, see [Community Object](https://docs.whisk.com/api/community/..#community-object).
{% endhint %}
{% endtab %}
{% endtabs %}
