> For the complete documentation index, see [llms.txt](https://markefan.gitbook.io/documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://markefan.gitbook.io/documents/index/mailmagazineupdate.md).

# 既存キャンペーンにリードを追加する

既存キャンペーンに指定したリードを追加します。

## HTTP種類 : PUT

## URL : \[BASE URL]/SpringRest/campaign/mailmagazine/update

## HTTP戻り値 : JSON

## パラメータ :

|      名 前      |                型                |  必 須 |
| :-----------: | :-----------------------------: | :--: |
| access\_token |              String             | True |
|   campaignId  |             Integer             | True |
|   customers   | Integer\[] (カンマで区切ったcustomerid) | True |

## JSON戻り値 例：

```javascript
{
    "code": 200,
    "message": " CampaignCustomers created ,",
    "status": "OK",
    "generatedId": null,
    "generatedIds": null,
    "statusObject": "OK"
}
```

## サンプルコード

このメソッドは既存のキャンペーンにリードを追加します。このメソッドを使用するには、キャンペーンID、リードID、アクセストークンを渡す必要があります。複数のリードIDを渡す場合は、カンマで区切ってください。\
このメソッドを実行すると、指定したキャンペーンに既に存在しているリードは除去され、指定したリードが追加されます。 更新が成功すると True の戻り値を返します。

```java
private boolean addTargetCustomerToCampaign(String accessToken , String campaignId, String customers) {
        try {
            HttpClient client = new DefaultHttpClient();
            HttpPut httpPut = new HttpPut(
                    "<API_BASE_URL>/SpringRest/campaign/mailmagazine/update?access_token=" + accessToken
                            + "&campaignId=" + campaignId + "&customers=" + customers);

            HttpResponse response = client.execute(httpPut);

            if (response.getStatusLine().getStatusCode() == 200) {
                return true;
            } else {
                return false;
            }
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }
```

## 呼び出し方法

```java
boolean update = addTargetCustomerToCampaign( “98d9a7ea-8669-45e6-b141-f663c8cb35b8”, "527", "25,81");
```


---

# 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://markefan.gitbook.io/documents/index/mailmagazineupdate.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.
