> For the complete documentation index, see [llms.txt](https://docs.mburger.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mburger.cloud/how-to/advance-section-retrieval/obtain-only-sections-with-a-defined-relation.md).

# Obtain only sections with a defined relation

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://mburger.cloud/api/blocks/<id>/sections?filter[relation]=<block_id>,<section_id>
-H "Accept: application/json" 
-H "X-MBurger-Token: <token>" 
-H "X-MBurger-Version: 3"
```

{% endtab %}

{% tab title="iOS SDK" %}

```swift
let filterParameter = MBFilterParameter(field: "relation",
                                        value: RELATION_BLOCK_ID + "," + RELATION_SECTION_ID)
MBClient.getSections(ofBlock: BLOCK_ID,
                     parameters: [filterParameter],
                     success: { (sections, paginationInfo) in
                                
                     },
                     failure: { error in
                                
                     })
```

{% endtab %}

{% tab title="Android SDK" %}

```kotlin
val arrayFilters = ArrayList<Any>()
filters.add(MBFilterParameter(key = "relation", 
                                 value = RELATION_BLOCK_ID + "," + RELATION_SECTION_ID))

val sectionsListener = object: MBSectionsResultListener{
            override fun onSectionsApiError(error: String) {
            }

            override fun onSectionsApiResult(sections: ArrayList<MBSection>, 
                                             block_id: Long, 
                                             paginationInfos: MBPaginationInfo) {
            }
        }
        
MBurgerTasks.askForSections(context = applicationContext, 
                         block_id = BLOCK_ID,
                         filters = arrayFilters,
                         getElements = true,
                         listener = sectionsListener)
```

{% endtab %}

{% tab title="PHP SDK" %}

```php
$response = (new MBurger())->getSections($block_id)->filterByRelation(int $block_id, int $section_id);
```

{% endtab %}

{% tab title="JS SDK" %}

```javascript
const mburger = require('mburger');

const instance = mburger.createClient({
    api_key: "12578sdfghjkl",
});


instance.getBlock({
    block_id: 884,
    filter: {
        'relation': 'block_id,section_id'
    }
}).then(result => console.log(result));

```

{% endtab %}

{% tab title="Flutter SDK" %}

```dart
MBFilterParameter filterParameter = MBFilterParameter(
  field: 'relation',
  value: RELATION_BLOCK_ID + ',' + RELATION_SECTION_ID,
);

MBPaginatedResponse<MBSection> sections =
    await MBManager.shared.getSections(
  blockId: BLOCK_ID,
  parameters: [filterParameter],
);
```

{% endtab %}
{% endtabs %}
