# Get Blocks

{% hint style="info" %}
How to obtain project blocks.
{% endhint %}

{% tabs %}
{% tab title="Request" %}
`GET https://mburger.cloud/api/blocks`

```bash
curl https://mburger.cloud/api/blocks?include=sections&sort=-title&filter[title]=%home,news
-H "Accept: application/json"
-H "X-MBurger-Token: <token>" 
-H "X-MBurger-Version: 3"
```

#### &#x20;Parameters

| Name                    | Type    | Required | Description                                                                                                                                      |
| ----------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| skip                    | int     | No       | Specify the number of items to skip for pagination.                                                                                              |
| take                    | int     | No       | Specify the number of items to get for pagination.                                                                                               |
| locale                  | string  | No       | For multilanguage projects specify the desired locale for elements values. If locale is not provided or found the project fallback will be used. |
| include                 | string  | No       | Specify which relations to load and include in response.                                                                                         |
| sort                    | string  | No       | Specify the blocks order.                                                                                                                        |
| filter                  | string  | No       | Specify filters on blocks.                                                                                                                       |
| image\_format           | string  | No       | Specify which image dimension to include in response. Values are *thumb*, *medium*, *large* and *original*. Default is *medium*.                 |
| force\_locale\_fallback | boolean | No       | If true and the requested locale is empty, the fallback locale is returned. Default false.                                                       |

#### &#x20;Includes

| Name      | Description                                                                                                                                                                                                     |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sections  | This relation will include all sections of each block. You can also send *sections.elements* to also obtain all the elements of every section in a single API call. Note that this will impact the performance. |
| structure | This relation will include all elements that define the structure of block.                                                                                                                                     |

#### &#x20;Sort

| Name  | Default | Description          |
| ----- | ------- | -------------------- |
| id    | Yes     | Sort by id.          |
| title | No      | Sort by title field. |
| order | No      | Sort by order field. |

#### &#x20;Filters

| Name         | Exact | Description              |
| ------------ | ----- | ------------------------ |
| id           | Yes   | You can filter by id.    |
| title        | No    | You can filter by title. |
| {% endtab %} |       |                          |

{% tab title="Response" %}
When successful, a HTTP 200 and JSON like this is returned:

```bash
{
  "status_code": 0,
  "body": {
    "meta": {
      "from": 0,
      "to": 2,
      "total": 2
    },
    "items": [
      {
        "id": 2,
        "order": 1,
        "title": "News",
        "subtitle": null,
        "url_title": "news",
        "is_single": false,
        "sections": [
          {
            "id": 1,
            "order": 1,
            "all_locales": true,
            "visible": true,
            "in_evidence": false,
            "available_at": 1543395018,
            "updated_at": 1546599688
          },
          {
            "id": 2,
            "order": 2,
            "all_locales": true,
            "visible": true,
            "in_evidence": false,
            "available_at": 1543395063,
            "updated_at": 1546599688
          }
        ]
      },
      {
        "id": 1,
        "order": 1,
        "title": "App Home",
        "subtitle": null,
        "url_title": "app-home",
        "is_single": false,
        "sections": [
          {
            "id": 3,
            "order": 3,
            "all_locales": true,
            "visible": true,
            "in_evidence": false,
            "available_at": 1543395081,
            "updated_at": 1546599688
          }
        ]
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}
