> 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/advanced-section-creation/create-a-section-with-a-relation.md).

# Create a section with a relation

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

```bash
curl https://mburger.cloud/api/blocks/<id>/sections
-X POST 
-H "Accept: application/json" 
-H "Content-Type: application/x-www-form-urlencoded"
-H "X-MBurger-Token: <token>" 
-H "X-MBurger-Version: 3"
-d "elements[<locale>][<element_type>]=<value>"
-d "relation[<index>]=<section_id>"
```

{% endtab %}

{% tab title="iOS SDK" %}

```swift
let factory = MBUploadableElementsFactory(localeIdentifier: "en")
let elements = [factory.createRelationElement(name: ELEMENT_NAME,
                                              blockId: RELATION_BLOCK_ID, 
                                              sectionId: RELATION_SECTION_ID)]
        
MBAdmin.addSectionToBlock(withBlockId: BLOCK_ID,
                          elements: elements,
                          success: { sectionId in
                                    
                          },
                          failure: { error in
                                    
                          })
```

{% endtab %}

{% tab title="Android SDK" %}

```kotlin
val relation_section_ids = ArrayList<Long>
relation_section_ids.add(A_SECTION_ID)

val params = ArrayList<MBAdminGenericParameter>()
params.add(MBAdminRelationsParameter(ELEM_NAME, relation_section_ids))

val addSectionListener = object: MBAdminAddSectionListener{
            override fun onSectionAdded(section_id: Long) {
            }

            override fun onSectionAddedError(error: String) {
            }
        }

MBurgerAdminTasks.addSection(
                    context = applicationContext, 
                    block_id = BLOCK_ID, 
                    listener = addSectionListener, 
                    params = params,
                    locale = Locale.getDefault().getLanguage());
```

{% endtab %}

{% tab title="PHP SDK" %}

```
// Work in progress
```

{% endtab %}

{% tab title="JS SDK" %}

```
// POST actions are not available atm on our JS SDK.
// If it could be interesting for you, please submit 
// a feature request here:
// https://support.mburger.cloud/hc/en-us/community/topics/360000550497-Feature-Request?
```

{% endtab %}

{% tab title="Flutter SDK" %}

```dart
MBUploadableElementsFactory factory = MBUploadableElementsFactory('en');
List<MBUploadableElement> elements = [
  factory.createRelationElement(ELMENT_NAME, [SECTION_ID]),
];
await MBAdmin.shared.addSectionToBlock(BLOCK_ID, elements);  }
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
An example of **elements** and **relation** passed could be

```bash
"elements['it']['text']=ilTuoTesto"
"elements['en']['text']=yourText"

"relation[0]=14"
"relation[1]=16"
```

where *14* and *16* are examples of section ids.
{% endhint %}
