# Updating an API definition on AWS API Gateway

Import a JSON file to AWS API Gateway to update an existing definition.

## Before you begin

* You have access to AWS API Gateway.
* You have installed AWS CLI. For more information, see [Installing the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html).
* You have exported your API definition as a JSON file.
* You have uploaded a previous version of the API definition to AWS API Gateway.

## Procedure

1. Open a command line and enter the following command to upload the file:
   ```
   aws apigateway put-rest-api --rest-api-id {api-id} --mode {mode} --body 'file://{yourfile}.json'
   ```
2. Add the correct parameters:
   | Parameter | Description |
   | --- | --- |
   | {api-id} | AWS API Gateway ID of the API to update. |
   | {mode} | Behavior at import. The value can be either<br>overwrite to replace the<br>previous version of the API with the new one, or merge to merge the two<br>versions. |
   | {yourfile} | Path and file name of the API definition you<br>exported. |
3. Execute the command.

## Results

Your API definition is merged or overwritten, depending on the mode you defined. You can check your update on the AWS API Gateway console.

In this example, a first version of the API definition containing only the /contacts resource and its operations was uploaded. Then, a second version with the /companies resource was uploaded and merged with the previous version.

![Screenshot of the merged API definition.](https://help.qlik.com/talend/en-US/api-designer-user-guide/Resources/images/aws_2.png)

For more information about the put-rest-api command, see the [AWS documentation](https://docs.aws.amazon.com/cli/latest/reference/apigateway/put-rest-api.html).