# データ変更

Eagle Plugin APIメソッドで取得した結果は、直接変更することができます。変更した結果を保存するには、結果オブジェクトの `save()` メソッドを呼び出すだけです。以下はいくつかの簡単な例です：

## **例1：現在のアプリケーションで選択されているファイルを変更する**

```javascript
// Eagleアプリで選択されているファイルを取得します
let items = await eagle.item.getSelected();
let item = items[0];

// タグを変更
item.tags = ['tag1', 'tag2'];

// 変更を保存
await item.save();

```

## **例2：フォルダ属性の変更**

```javascript
// Eagleアプリで選択されているフォルダを取得します
let folder = (await eagle.folder.getSelected())[0];

// 属性を変更
folder.name = 'New Folder Name';
folder.description = 'New description...';

// 変更を保存
await folder.save();
```

{% hint style="success" %}
**🦄 ベストプラクティス：** データの安全性を確保するために、APIで提供される `save()` メソッドを使用してデータの保存や変更を行い、Eagleリソースリポジトリ内の任意のファイルを直接変更することは避けてください。
{% 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://developer.eagle.cool/plugin-api/ja-jp/tutorial/modify-eagle-data.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.
