# ModifyAction Method

## Description

Modifies an existing action. The action type cannot be modified for existing actions.

## HTTP Request

`PUT https://api.skeddly.com/api/Actions/{id}`

## URL Parameters

### id

The ID of the action.

Type: `string`

Required: Yes

## Body

The body is a JSON structure with the following properties.

### comments

User notes for the action.

Type: `string`

Required: No

### isEnabled

True to indicate that the action is executable. False otherwise.

Type: `boolean`

Required: No

Default: `false`

### isTriggerBySns

True to indicate that the action should be triggerable by an SNS topic.

Type: `boolean`

Required: No

Default: `false`

### name

Name of the action.

Type: `string`

Required: Yes

### parameters

Additional action parameters specific to the action type.

Type: [ActionParameters](https://docs.skeddly.com/data-types/actionparameters-object) object.

Required: Yes

### schedule

Schedule for the action.

Type: [ActionSchedule](https://docs.skeddly.com/data-types/actionschedule-object) object

Required: Yes

### tags

Tags for the action.

Type: array of `string`

Required: No

## Returns

An [Action](https://docs.skeddly.com/data-types/action-object) object.

## Sample Request

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

```http
PUT /api/Actions/a-00000001 HTTP/1.1
Host: api.skeddly.com
Authorization: AccessKey <api key>

{
    "name": "My action",
    "isEnabled": true,
    "schedule": {
        "scheduleType": "daily",
        "startDate": "2018-02-26",
        "timeOfDay": "12:05:00",
        "endDate": "2018-02-28",
        "timeZoneId": "Eastern Standard Time",
        "parameters": {
            "days": [
                "monday", "friday"
            ]
        }
    },
    "parameters": {    
        "credentialIds": [ "cred-4d1a201c" ],
        "regionNames": [ "us-east-1" ],

        "instanceIdentificationMethod": "all-instances",
        "ConsistencyMethod": "none",
        "Description": "backups-$(DATE)"
    }
}
```

{% endtab %}

{% tab title="Bash" %}

```bash
curl -X PUT "https://api.skeddly.com/api/Actions/a-00000001"
  -H "Authorization: AccessKey <api key>"
  -d name="My action" \
  -d isEnabled=true \
  -d schedule.scheduleType=daily \
  -d schedule.startDate=2018-02-26 \
  -d schedule.timeOfDay="12:05:00" \
  -d schedule.endDate=2018-02-28 \
  -d schedule.timeZoneId="Eastern Standard Time"\
  -d schedule.parameters.days[]=monday \
  -d schedule.parameters.days[]=friday \
  -d parameters.credentialIds[]=cred-4d1a201c \
  -d parameters.regionNames[]=us-east-1 \
  -d parameters.instanceIdentificationMethod=all-instances \
  -d parameters.ConsistencyMethod=none \
  -d parameters.Description="backups-$(DATE)" \
```

{% endtab %}

{% tab title="Python" %}

```python
import skeddly
client = skeddly.Client()
action = client.modify_action(
    "a-12345678",
    name = "Start Development Instances",
    isEnabled = True,
    schedule = {
        "scheduleType": "daily",
        "startDate": "2019-01-01",
        "timeOfDay": "08:00:00",
        "timeZoneId": "Eastern Standard Time",
        "parameters": {
            "days": [
                "monday",
                "tuesday",
                "wednesday",
                "thursday",
                "friday"
            ]
        }
    },
    parameters = {
        "CredentialIds": [
            "cred-12345678"
        ],
        
        "instanceIdentificationMethod": "all-instances",
        "isStop": True
    }
)
```

{% endtab %}
{% endtabs %}

## Sample Response

```javascript
{
    "actionId": "a-00000001",
    "actionType": "amazon-backup-ec2-instances",
    "actionVersionId": "av-00000001",
    "isCurrentVersion": true,
    "isEnabled": true,
    "lastModifiedBy": "u-00000001",
    "lastModifiedDate": "2016-06-09T12:21:00Z",
    "name": "My action",
    "nextExecutionDate": "2016-06-10T12:23:00Z",
    "schedule": {
        "scheduleType": "daily",
        "startDate": "2016-06-10",
        "timeOfDay": "12:23:00",
        "timeZoneId": "Eastern Standard Time",
        "parameters": {
            "days": [
                "monday",
                "friday"
            ]
        }
    },
    "parameters": {    
        "credentialIds": [ "cred-4d1a201c" ],
        "regionNames": [ "us-east-1" ],

        "instanceIdentificationMethod": "all-instances",
        "ConsistencyMethod": "none",
        "Description": "backups-$(DATE)"
    }
}
```
