> 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/android-docs/admin-feature/update-an-existing-section.md).

# Update an existing Section

Updating a section is a process very similar to creating a new one, but you will need the id of the section you wish to update--the block\_id is not necessary.&#x20;

{% hint style="info" %}
You should only pay attention in that you must provide a valid locale and only the section with the given locale will be updated; other locale variants will remain untouched.
{% endhint %}

&#x20;Also, all media you will send through the API will be appended to the pre-existent array of media.&#x20;

If you wish to replace and image or a media you will need to call the **`MBurgerAdminTasks.deleteMedia(this, media_id)`** method before calling the update.

If you wish to update a section, the method is similar to creating one:

```kotlin
//EditTexts for inserting content
val edt_title: EditText
val edt_content: EditText
val edt_link: EditText

var listener: MBAdminApiUpdateSectionListener

val section_id = //ID of the section you wish to update

//URI of the image, taken from camera or gallery
var img_uri: Uri

//Set if you want this section to be hidden when requesting for block sections, or not
val show_in_app = true;

fun updateSection() {
    val params = ArrayList<MBAdminParameter>()
    params.add(MBAdminParameter(“title”, edt_title.getText().toString()))
    params.add(MBAdminParameter(“content”, edt_content.getText().toString()))
    params.add(MBAdminParameter(“link”, edt_link.getText().toString()))

    val params_file = ArrayList<MBAdminParameterFile>()
    val files = ArrayList<MBAdminSingleFile>()
    
    files.add(MBAdminSingleFile(getFileName(), 
                                getMimeType(), 
                                getUriRealPath(application, img_uri)))
                                
    params_file.add(MBAdminParameterFile(“image”, files))

    MBurgerAdminTasks.updateSection(applicationContext, 
                            section_id, 
                            listener, 
                            params, 
                            params_file, 
                            Locale.getDefault().getLanguage(), show_in_app);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mburger.cloud/android-docs/admin-feature/update-an-existing-section.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
