Building API operations - Amazon DynamoDB
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Building API operations

To use the NoSQL Workbench to build DynamoDB CRUD APIs, select Interface-based operations at the top right corner of the NoSQL Workbench.

Then go to the Operations drop-down and choose the operation that you want to build.

You can perform the following operations in the operation builder.

Table Operations

Item Operations

Table operations

Delete table

To run or generate code for a Delete Table operation, do the following.

  1. Select Delete Table from the Operations dropdown list.

  2. Select the table from the Table name dropdown list.

  3. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  4. If you want the operation to be run immediately, choose Run.

    In the confirmation window that appears, confirm by entering the table name and selecting Delete.

    
                                Console screenshot showing the PutItem operation
                                    builder.

    Results of the operation will appear in the results tab at the bottom of the screen.

For more information about this operation, see Delete table in the Amazon DynamoDB API Reference.

Create table

To run or generate code for a Create Table operation, do the following.

  1. Select Create Table from the Operations dropdown list.

  2. Enter the table name desired.

  3. Create a partition key.

  4. Configure the table as desired. You can create a Global Secondary Index, enable autoscaling, and other options.

  5. To customize capacity settings, go to Capacity Settings and uncheck the box next to Default settings.

    • You can now select either Provisioned or On-demand capacity.

      With Provisioned selected, you can set minimum and maximum read and write capacity units. You can also enable or disable auto scaling.

    • If the table is currently set to OnDemand, you will be unable to specify a provisioned throughput.

    • If you switch from OnDemand to Provisioned throughput, then Autoscaling will automatically be applied to all GSIs with: min: 1, max: 10; target: 70%.

  6. If you want to clear all new settings you've made and start over, select Clear form.

  7. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  8. If you want the operation to be run immediately, choose Run.

    Results of the operation will appear in the results tab at the bottom of the screen.

  9. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

    
                                Console screenshot showing the PutItem operation
                                    builder.

For more information about this operation, see Create table in the Amazon DynamoDB API Reference.

Update table

To run or generate code for an Update Table operation, do the following.

  1. Select Update Table from the Operations dropdown list.

  2. Select the desired operation from the Update operations dropdown list.

  3. Select the table from the Table name dropdown list.

  4. Update the selected table as desired. You can create a GSI, update provisioned throughputs and other options.

  5. If you select Create GSI, Update Provisioned Throughput or Update Provisioned Throughput for GSI the Capacity settings option will appear.

  6. To customize capacity settings, go to Capacity Settings. Then uncheck the option for either Inherit capacity settings from base table or On-demand.

    • You can now select either Provisioned or On-demand capacity.

      With Provisioned selected, you can set minimum and maximum read and write capacity units. You can also enable or disable auto scaling.

    • If the table is currently set to OnDemand, you will be unable to specify a provisioned throughput.

    • If you switch from OnDemand to Provisioned throughput, then Autoscaling will automatically be applied to all GSIs with: min: 1, max: 10; target: 70%.

  7. If you want to clear the settings you've just entered and start over, Clear form.

  8. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  9. If you want the operation to be run immediately, choose Run.

    Results of the operation will appear in the results tab at the bottom of the screen.

  10. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

    
                                Console screenshot showing the PutItem operation
                                    builder.

For more information about this operation, see Update table in the Amazon DynamoDB API Reference.

Item operations

Get item

To run or generate code for a Get Item operation, do the following.

  1. Specify the partition key value.

  2. If you want to add a projection expression , do the following:

    1. Choose Projection expression.

    2. Choose the + (plus sign) next to Projection expression.

    3. Specify the Attribute name.

    
                                Console screenshot showing the GetItem operation
                                    builder.
  3. If you want to generate code, choose Generate code.

    Select your desired language from the displayed tabs. You can now copy this code and use it in your application.

  4. If you want the operation to be run immediately, choose Run.

  5. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about this operation, see GetItem in the Amazon DynamoDB API Reference.

Put item

To run or generate code for a Put Item operation, do the following.

  1. Specify the partition key value.

  2. Specify the sort key value, if one exists.

  3. If you want to add non-key attributes, do the following:

    1. Choose the + (plus sign) next to Other attributes.

    2. Specify the Attribute name, Type, and Value.

  4. If a condition expression must be satisfied for the Put Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition expressions.

    
                                Console screenshot showing the PutItem operation
                                    builder.
  5. If you want to generate code, choose Generate code.

    Select your desired language from the displayed tabs. You can now copy this code and use it in your application.

  6. If you want the operation to be run immediately, choose Run.

  7. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about this operation, see PutItem in the Amazon DynamoDB API Reference.

Update item

To run or generate code for an Update Item operation, do the following:

  1. Enter the partition key value.

  2. Enter the sort key value, if one exists.

  3. In Update expression, choose the expression in the list.

  4. Choose the + (plus sign) for the expression.

  5. Enter the attribute name and attribute value for the selected expression.

  6. If you want to add more expressions, choose another expression in the Update Expression drop-down list, and then select the +.

  7. If a condition expression must be satisfied for the Update Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition expressions.

    
                                Console screenshot showing the UpdateItem operation
                                    builder.
  8. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  9. If you want the operation to be run immediately, choose Run.

  10. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about this operation, see UpdateItem in the Amazon DynamoDB API Reference.

Delete item

To run or generate code for a Delete Item operation, do the following.

  1. Enter the partition key value.

  2. Enter the sort key value, if one exists.

  3. If a condition expression must be satisfied for the Delete Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition expressions.

    
                                Console screenshot showing the DeleteItem operation
                                    builder.
  4. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  5. If you want the operation to be run immediately, choose Run.

  6. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about this operation, see DeleteItem in the Amazon DynamoDB API Reference.

Query

To run or generate code for a Query operation, do the following.

  1. Specify the partition key value.

  2. If a sort key is needed for the Query operation:

    1. Select Sort key.

    2. Specify the comparison operator, attribute type, and attribute value.

  3. If not all the attributes should be returned with the operation result, select Projection expression.

  4. Choose the + (plus sign).

  5. Enter the attribute to return with the query result.

  6. If more attributes are needed, choose the + .

  7. If a condition expression must be satisfied for the Query operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition expressions.

    
                                Console screenshot showing the Query operation
                                    builder.
  8. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  9. If you want the operation to be run immediately, choose Run.

  10. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about this operation, see Query in the Amazon DynamoDB API Reference.

Scan

To run or generate code for a Scan operation, do the following.

  1. If not all the attributes should be returned with the operation result, select Projection expression.

  2. Choose the + (plus sign).

  3. Specify the attribute to return with the query result.

  4. If more attributes are needed, choose the + again.

  5. If a condition expression must be satisfied for the scan operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition expressions.

  6. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  7. If you want the operation to be run immediately, choose Run.

  8. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

TransactGetItems

To run or generate code for a TransactGetItems operation, do the following.

  1. Choose the + (plus sign).

  2. Follow the instructions for the Get item operation.

    When you are done specifying the details of the operation, choose the + (plus sign) if you want to add more operations.

    
                                Console screenshot showing the plus sign button in
                                    transactgetitems operation builder.

    To change the order of actions, choose an action in the list on the left side, and then choose the up or down arrows to move it up or down in the list.

    To delete an action, choose the action in the list, and then choose the Delete (trash can) icon.

  3. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  4. If you want the operation to be run immediately, choose Run.

  5. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about transactions, see Amazon DynamoDB transactions.

TransactWriteItems

To run or generate code for a TransactWriteItems operation, do the following.

  1. In the Actions drop-down list, choose the operation that you want.

    • For DeleteItem, follow the instructions for the Delete item operation.

    • For PutItem, follow the instructions for the Put item operation.

    • For UpdateItem, follow the instructions for the Update item operation.

    When you are done specifying the details of the operation, choose the + button.

    
                                Console screenshot showing the plus sign button in
                                    transactwriteitems operation builder.

    To change the order of actions, choose an action in the list on the left side, and then choose the up or down arrows to move it up or down in the list.

    To delete an action, choose the action in the list, and then choose the Delete (trash can) icon.

    
                                Console screenshot showing the up and down arrows and trash
                                    can buttons in operation builder.
  2. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  3. If you want the operation to be run immediately, choose Run.

  4. If you want to save this operation for later use, choose Save operation, then enter a name for your operation and click Save.

For more information about transactions, see Amazon DynamoDB transactions.