You can invoke an Action you have defined in AppSheet.

You can only invoke the following types of Actions from the API:

  1. Data: set the value of a column
  2. Grouped: execute a sequence of actions.
    All actions invoked in the Grouped sequence must be either "Data: set the value of a column" or "Grouped: execute a sequence of actions".

URL

Use a URL in the following form to invoke the API.

POST https://api.appsheet.com/api/v2/apps/{appId}/tables/{tableName}/Action where

  • {appId} specifies the GUID of the AppSheet application.
  • {tableName} specifies the name of the table.

Body

The HTTP Body contains:

  1. The Action name.
  2. Optional properties such as Locale, Location, and Timezone.
    The Locale is used when validating Date, Time, DateTime, Decimal, Percent, and Price data values. For example, when Locale is "en-US", date values must be entered in MM/DD/YYYY format. When Locale is "en-GB", date values must be entered in DD/MM/YYYY format.
  3. One, or more, Row values specifying the key field values of the records to which the Action is applied. In the following example, the key fields of the record are "FirstName" and "LastName".

    When you wish to invoke an action on two or more rows, it is more efficient to invoke the action on all of the rows in a single API call than to invoke the action on each row in a separate API call. Using a single API call is significantly more efficient because we make few calls to the data provider.

    When you invoke the API from an AppSheet Webhook, you can use the technique described in topic "Creating a JSON Body Template File with <<Start>> and <<End>> Tags" in this article to create a JSON body containing two or more rows.

{
"Action": "IncrementCountAction",
"Properties": {
   "Locale": "en-US",
   "Location": "47.623098, -122.330184",
   "Timezone": "Pacific Standard Time",
   "UserSettings": {
      "Option 1": "value1",
      "Option 2": "value2"
   }
},
"Rows": [
{
"FirstName": "Jan",
"LastName": "Jones"
},
{
"FirstName": "Ian",
"LastName": "Ivans",
}
]

API Response Content

The API returns the updated rows in HTTP contents.

{
  "Rows": [
{
"_RowNumber": 10,
"FirstName": "Jan",
"LastName": "Jones",
"Age": 33,
"Department": "Accounting",
"Street": "110 Beach Blvd",
"City": "Newport Beach",
"State": "CA",
"Zip": 92661,
"Home Phone": 4257868765,
"Fax": 4253214432,
"Date Hired": "10/31/2014",
"Arrived": "8:15:25",
"Departed": "18:30:33",
"Last Review": "08/31/2017 23:59:59",
"Rating": 0.9950,
"Salary": 3333.45,
"Image": "http://images6.fanpop.com/image/photos/36300000/Emilia-Clarke-image-emilia-clarke-36399128-460-276.jpg"
},
{
"_RowNumber": 11,
"FirstName": "Ian",
"LastName": "Ivans",
"Age": 22,
"Department": "Payroll",
"Street": "118 E Oceanfront",
"City": "Newport Beach",
"State": "CA",
"Zip": 92661,
"Home Phone": 4257868148,
"Fax": 4253217798,
"Date Hired": "09/30/2014",
"Arrived": "7:40:25",
"Departed": "19:22:33",
"Last Review": "09/30/2017 23:59:59",
"Rating": 0.9750,
"Salary": 4444.45,
"Image": "http://images4.fanpop.com/image/photos/16300000/Christopher-Walken-3-christopher-walken-16367376-720-480.jpg"
}
]
}

API Response HTTP Status Codes

The API returns the following HTTP status codes. 

  1. 200 Success
  2. 400 Bad Request
    a. The Application Access Key is missing.
    b. The AppId is missing.
    c. The Post body contains invalid data.
  3. 403 Forbidden
    a. The Web API is not enabled for this application.
    b. The Application Access Key is invalid.
  4. 404 Not Found
    a. The application specified by the AppId cannot be found.
  5. 500 Internal Server Error
    a. An unexpected error occurred.

When a Action is Invoked

  1. The Data Change action is applied to the record or records.
  2. The record or records are updated in the table.
  3. Workflow rules, if any, are invoked. 
  4. The updated record or records are returned in the HTTP content.
Did this answer your question?