How to include REF_ROWS in a JSON payload?

Hi all!
I'm trying to get a JSON payload to use with a Zapier webhook in order to process a customer's quote. 

Table 'Baskets'  has a few dozen columns with different bits and bobs, but the part that's giving me the headache is column 'Basket' which is List of REF_ROWS with basket line items from table Basket Details (standard 'Add to Cart' structure)

Here's my JSON payload:

{
"BasketID": "<<[Basket ID]>>",
"Basket Status": "<<[Basket ID].[Basket Status]>>",
"StaffName": "<<[Basket ID].[Staff Name]>>",
"Quote Status": "<<[Basket ID].[Quote Status]>>",
"LastEditDateTime": "<<[Basket ID].[Last Edit DateTime]>>",
"CustomerFirstName": "<<[Basket ID].[Customer First Name]>>",
"CustomerLastName": "<<[Basket ID].[Customer Last Name]>>",
"CustomerPhone": "<<[Basket ID].[Contact Phone 1]>>",
"CustomerDueDate": "<<[Basket ID].[Customer Due Date]>>",
"CustomerEmail": "<<[Basket ID].[Customer Email]>>",
"Fulfillment": "<<[Basket ID].[Fulfilment]>>",
"EstimatedFulfillmentDate": "<<[Basket ID].[Estimated Fulfillment Date (+- 10 days)]>>",
"CustomerPostCode": "<<[Basket ID].[Customer Postcode]>>",
"StateCounter": "<<[Basket ID].[StateCounter]>>",
"RRPTotal": "<<[Basket ID].[RRP Total]>>",
"SavingsTotal": "<<[Basket ID].[Savings Total]>>",
"QuoteTotal": "<<[Basket ID].[Quote Total]>>",
"DepositRequired": "<<[Basket ID].[Deposit Required]>>",
"MarketingOptOut": "<<[Basket ID].[Marketing Opt Out]>>",
"QuoteNotes": "<<[Basket ID].[Quote Notes]>>",

"Basket":  ???

}

I am not very experienced with JSON and nested objects, could someone please explain how to include the list of REF_ROWS and all their parameters (ID, Name, Price, RRP, Savings) in the JSON payload? And how to do it so it works regardless of how many items are added to the list?

Solved Solved
0 4 171
1 ACCEPTED SOLUTION

JSON

Basket would be a list [] with objets inside [{}, {}, {}]
Use a Start: expression to get the values for the list

Use Start expressions in templates - AppSheet Help

View solution in original post

4 REPLIES 4

JSON

Basket would be a list [] with objets inside [{}, {}, {}]
Use a Start: expression to get the values for the list

Use Start expressions in templates - AppSheet Help

Thank you, these resources have helped me - just managed to send a basket across!
Screenshot 2023-05-24 105338.png

I'd say it depends on what the expected structure is. Can you show an example of a proper payload with at least 2 line items?

Thank you, I managed to solve it. 

Here's my final payload that worked:

 

Show More
{
"BasketID": "<<[Basket ID]>>",
"Basket Status": "<<[Basket ID].[Basket Status]>>",
"StaffName": "<<[Basket ID].[Staff Name]>>",
"Quote Status": "<<[Basket ID].[Quote Status]>>",
"LastEditDateTime": "<<[Basket ID].[Last Edit DateTime]>>",
"CustomerFirstName": "<<[Basket ID].[Customer First Name]>>",
"CustomerLastName": "<<[Basket ID].[Customer Last Name]>>",
"CustomerPhone": "<<[Basket ID].[Contact Phone 1]>>",
"CustomerDueDate": "<<[Basket ID].[Customer Due Date]>>",
"CustomerEmail": "<<[Basket ID].[Customer Email]>>",
"Fulfillment": "<<[Basket ID].[Fulfilment]>>",
"EstimatedFulfillmentDate": "<<[Basket ID].[Estimated Fulfillment Date (+- 10 days)]>>",
"CustomerPostCode": "<<[Basket ID].[Customer Postcode]>>",
"StateCounter": "<<[Basket ID].[StateCounter]>>",
"RRPTotal": "<<[Basket ID].[RRP Total]>>",
"SavingsTotal": "<<[Basket ID].[Savings Total]>>",
"QuoteTotal": "<<[Basket ID].[Quote Total]>>",
"DepositRequired": "<<[Basket ID].[Deposit Required]>>",
"MarketingOptOut": "<<[Basket ID].[Marketing Opt Out]>>",
"QuoteNotes": "<<[Basket ID].[Quote Notes]>>",
"Basket": [
<<Start:[Basket ID].[Basket]>>
{
"DetailID" : "<<[Detail ID]>>",
"BasketID" : "<<[Basket ID]>>",
"ProductID" : "<<[Product ID]>>",
"QTY" : "<<[QTY]>>",
"CreatedBy" : "<<[Created By]>>"
}
<<End>>
]
}

 

 

 

Top Labels in this Space