Is it possible to include Appsheet Expressions while Invoking Action through API

Hi,

I am trying to invoke an Edit Action through API. The JSON is given below

 

{
"Action": "Edit",
 "Properties": {
    "Locale": "en-GB",
"Timezone": "India Standard Time"
  },
"Rows": [
{
"Date":"<<Today()>>",
"Check-in":"<<UTCNOW()>>"
}
]
}

 

However, I am getting the foloowing error

 

{
    "Message": "REST API invoke request failed - Row having key '<<Today()>>' not found."
}

 

Am i doing it wrong or is it not possible to include appsheet expression like this inside JSON. When I invoke the action from within Appsheet through Call a Webhook, these expressions are working as expected. But when i try to invoke externally through HTTP POST, i am getting this error. 

Solved Solved
0 6 147
1 ACCEPTED SOLUTION

Either determine today's date from wherever you're invoking the API or else first retrieve the row you want to edit using AppSheet's Find API action, where AFAIK you can indeed include any AppSheet function in the selector property.

View solution in original post

6 REPLIES 6

It's indeed possible to use the API to invoke any action defined within an app.

Maybe confirm whether the value being returned by the TODAY function is in your expected timezone and locale.

Hi @dbaum . Thanks for the reply.

I am invoking the api not from appsheet but externally through HTTP post request. 

The same code when invoked from within appsheet works fine. Also when if i change the today () in JSON with actual date, it works fine from external also. 

I think the appsheet expressions are not considered when invoked externally. I am saying this because the error message returned by appsheet when the api is invoked externally says that row with key '<<Today()>>' not found. Its not evaluating the expression. Actually it should have responded like row with key '26/12/2022' not found. Hope you got the point. 


@jyothis_m wrote:

I think the appsheet expressions are not considered when invoked externally.


For sure. Notation like "<<TODAY()>>" is for reference by AppSheet in a template for creating something sent from AppSheet to something external (e.g., webhook, email). Those template expressions would not function outside of AppSheet.

If you don't already have the relevant data available wherever you're invoking the API from, you may need to first retrieve it using the Find API action.

Thanks @dbaum I didn't know that. I thought appsheet expressions were possible inside the JSON when invoked externally.

My requirement was to edit the Row having key value as Today's date. How can this be achieved when the api is called externally. 

Either determine today's date from wherever you're invoking the API or else first retrieve the row you want to edit using AppSheet's Find API action, where AFAIK you can indeed include any AppSheet function in the selector property.

Thanks @dbaum 


@dbaum wrote:

determine today's date from wherever you're invoking the API


 

I have implemented it this way.👍

Top Labels in this Space