I’m having some trouble with a custom AppSheet API Webhook and not quite sure how to approach this anymore.
URL:https://api.appsheet.com/api/v2/apps/“AppID”/tables/Jobs/Action
HTTP Verb: Post
HTTP Content Type: JSON
Body
{
"Action": "Add",
"Properties": {
"Locale": "en-US",
"Location": "47.623098, -122.330184",
"Timezone": "Pacific Standard Time",
},
"Rows": [
<<Start: SELECT(Customers[ID], AND([Account Status] = "Active", [Service Date] = TODAY(), OR([Service Type] = "1x Clean Yard",[Service Type] = "Rush 1x Service")))>>
{
"ID": "<<UNIQUEID()>>",
"Job Status": "Incomplete",
"Customer ID": "<<[ID]>>",
"Assigned Scooper": "<<[Scooper Assigned]>>"
}
<<End>>
]
}
Audit Log Details
Error:
"No API 'Rows' are present."
Properties:
{
"RestAPIVersion": 2,
"TableName": "Jobs",
"AppTemplateVersion": "1.000137",
"AppTemplateName": "AppID",
"Operation": "REST API invoke",
"RecordType": "Stop",
"ResultSuccess": false,
"StatusCode": "BadRequest",
"Result": "Failure"
}
Solved! Go to Solution.
Ah, I guess that’s the problem. it’s running the webhook and the SELECT expression is returning nothing. going to add a Condition in the Report to ensure the count of the list is greater than 0 before it actually runs the webhook. This should stop it from running and creating the error, Oops.
COUNT(SELECT(Customers[ID], AND([Account Status] = "Active", [Service Date] = TODAY(), OR([Service Type] = "1x Clean Yard",[Service Type] = "Rush 1x Service")))) > 0
Thanks for the help guys!
@Jessy_Mrozowski
Are you trying to add a record with API?
@LeventK
Yes
@Jessy_Mrozowski
You had forgotten a “comma” in the JSON body
{
"Action": "Add",
"Properties": {
"Locale": "en-US",
"Location": "47.623098, -122.330184",
"Timezone": "Pacific Standard Time",
},
"Rows": [
<<Start: SELECT(Customers[ID], AND([Account Status] = "Active", [Service Date] = TODAY(), OR([Service Type] = "1x Clean Yard",[Service Type] = "Rush 1x Service")))>>
{
"ID": "<<UNIQUEID()>>",
"Job Status": "Incomplete",
"Customer ID": "<<[ID]>>",
"Assigned Scooper": "<<[Scooper Assigned]>>"
},
<<End>>
]
}
Still getting this response
Properties:
{
"RestAPIVersion": 2,
"TableName": "Jobs",
"AppTemplateVersion": "1.000138",
"AppTemplateName": "AppID",
"Operation": "REST API invoke",
"RecordType": "Stop",
"ResultSuccess": false,
"StatusCode": "BadRequest",
"Result": "Failure"
}
@Jessy_Mrozowski
Have you tested if your SELECT expression returns any records?
This is what I found for the 400 Bad Request
However I have triple checked all of these.
@Jessy_Mrozowski I’m not asking if the expression is valid or not, I’m asking when you click the TEST button left to save, does the evaluation preview return any records?
Ah, I guess that’s the problem. it’s running the webhook and the SELECT expression is returning nothing. going to add a Condition in the Report to ensure the count of the list is greater than 0 before it actually runs the webhook. This should stop it from running and creating the error, Oops.
COUNT(SELECT(Customers[ID], AND([Account Status] = "Active", [Service Date] = TODAY(), OR([Service Type] = "1x Clean Yard",[Service Type] = "Rush 1x Service")))) > 0
Thanks for the help guys!
@Jessy_Mrozowski
1.) Your endpoint URL shall look like this. Please verify:
URL:https://api.appsheet.com/api/v2/apps/7e536009-e779-4ba7-aee2-c1cb5be53e79/tables/Jobs/Action
2.) Please verify, if you have provided/specified the Application Access Key and Content-Type parameters in the HTTP headers of your webhook workflow:
Have you tested your select formula in a virtual column? What does the formula return?
wait… you’re doing an add, so why have the select?
@MultiTech_Visions he is trying to add multiple rows one at a time with API. Read it from here:
It’s got to be something with the select then, the error is reporting that it can’t find any records.
You’re welcome @Jessy_Mrozowski, glad you figured it out
User | Count |
---|---|
36 | |
33 | |
27 | |
23 | |
18 |