Often we do not require any data from a webhook call - it is sufficient to simply receive a notification that an event has occurred. This is true for instance with the Ruby Scrape Webhook.
# Ruby Scrape Webhook Parameters
Here are the current ruby scrape webhook that Ward is posting looks like this:
`curl -XPOST -H 'Auth:3546736' -H 'Content-type:text/json' http://3d.local:6789/scrape -d '#{counts.to_json}’`
The data Wards `post`s should be a json string with stats that looks like this:
{ "date": 1606941254, "scan": { "sites": 1229, "pages": 58105 }, "index": { "counts": 7619, "items": 415995, "links": 101341, "plugins": 83, "sites": 2321, "slugs": 42532, "words": 214945 } }
I parse the json from this post in the webhook using:
put postArray ["date"] into lastUpdatedSeconds -- put postArray ["scan"]["pages"] into scanPageNum put postArray ["scan"]["sites"] into scanSiteNum - put postArray ["index"]["scan"] into scanNum put postArray ["index"]["sites"] into siteNum put postArray ["index"]["slugs"] into slugNum
My test’s successful acknowledgement shows up in the search’s activity report. Notice “Hello World” or whatever the data you return is in the following link: - http://ward.asia.wiki.org/search.fed.wiki.org:3030/recent-activity
We return at the moment page-json which you can view here:
- http://fedwiki.org/view/welcome-visitors/rest.livecode.world/scrape-report
And takes the form:
{ "title": "Scrape Report", "journal": [ { "date": 1609084798915, "item": { "title": "Scrape Report", "story": "" }, "type": "create" } ], "story": [ { "id": "65f70d9a-9f7d-457c-ab10-26ec67eeba16", "type": "markdown", "text": "Thanks for update ? on Sun, 27 Dec 2020 10:59:58 -0500. That makes an unknown number of sites indexed to date. I will return something useful here in the future" } ] }
# See also - Wiki Webhook and curl - Ruby Scrape Webhook and Webhook Parameters - Asynchronous Webhook Actions - Transport Server