Jump to content

falk0069

Member
  • Posts

    2
  • Joined

  • Last visited

Posts posted by falk0069

  1. To add my previous post, here is a quick PowerShell script I wrote to parse the JSON payload and convert it to a CSV (Excel) output.  Very little error checking done.  Just paste in Excel and delimit by the comma.  Hope it works for others.

    
    
    
    $payload = 'PASTE ENTIRE JSON PAYLOAD HERE'
    
    $results = ConvertFrom-Json $payload
    
    Write-Output "Date,Donor,Email,Phone,Amount,Currency,DonationType,Label0,Field0,Label1,Field1"
    $(ForEach($r in $results.contributions){
        $Date = (Get-Date -Date "01-01-1970") + ([System.TimeSpan]::FromMilliSeconds(($r.submittedOn))) 
        $Donor = $r.donor.name
        $Email = $r.donor.email
        $Phone = $r.donor.phone
        $Amount = $r.amount.decimalValue
        $currency = $r.amount.currencyCode
        $DonationType = $r.donationTitle
        $Label0 = $Value0 = $Label1 = $Value1 = ""
        if($r.formData){
          $Label0 = $r.formData.fields[0].label
          $Value0 = $r.formData.fields[0].value
          $Label1 = $r.formData.fields[1].label
          $Value1 = $r.formData.fields[1].value
        }
        Write-Output "`"$($Date)`",$($Donor),$($Email),$($Phone),$($Amount),$($Currency),$($DonationType),$($Label0),`"$($Value0)`",$($Label1),`"$($Value1)`""
    }) 

     

  2. If it helps, I did find the data can be pull with a resp call.  And actually if you open the DevTool [f12] in the browsers when you click on 'Donations' you will see a URL like this is used:

    https://SITENAME.squarespace.com/api/rest/commerce/contributions?offset=0&limit=100

    If you browse to it, it will return a JSON payload with all the data.  Change to 'limit=100' to get more records.  The tricky part is now how to parse the JSON data the easiest.  

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.