# Fetch sections from blocks

Setting the specific block\_id, it is possible to obtain the corresponding section’s data.&#x20;

If you want, you can include whether or not you want to filter the elements of the section by adding an array of filters.

The process to reach the result is the same as the blocks’ example:

* **Create, initialize** and **pause** the BroadcastReceiver (using “forSections” method).
* **Call** the task.
* **Fetch** the sections from the response of onApiResult.

Your code should be like this:

```kotlin
override fun onResume() {
    super.onResume()
    /**Create your sections’ receiver**/
    bRec = MBurgerApiActionInitializer.initializeNookoReceiverForSections(this, this)

    /**Add custom filters to the API call or leave it null**/
    val arrayOfFilters : ArrayList<Any> = null

    /**Id of the block you wish to retrieve sections**/
     val block_id = block.getId()

     /**Inside the sections the “elements” field will be valorized**/
     val getElements = true

     /**Call sections’ API**/
     MBurgerTasks.askForSections(this, block_id, arrayOfFilters, getElements)
}

override fun onPause() {
    super.onPause()
    MBurgerApiActionInitializer.pauseNookoReceiver(getActivity(), bRec)
}

override fun onApiResult(response: MBAPIResponse ) {
    if (response.getResult()) {
       val sections = response.getPayload().get(MBApiPayloadKeys.key_sections) as ArrayList<MBSection>
        if (sections.size() > 0) {
            //Your code
        } else {
            Log.w(“WARNINGS HOME”, “THE HOME’ S SECTION IS EMPTY”)
        }
    } else {
        Log.e(“ERROR RESPONSE API”, “THERE WAS AN ERROR DURING HOME’ S LOADING”)
    }
}
```

{% hint style="warning" %}
If you specify more filters of the same type inside the array, **only the last one of those type will be considered**.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mburger.cloud/android-docs/fetch-sections-from-blocks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
