Search notes:

Stackexchange Web API

function get-webApiJson {
   param (
      [string] $url
   )
 
   $res = invoke-webRequest $url
   convertFrom-json $res.Content
}
$version = '2.3'
$baseUrl = "https://api.stackexchange.com/$version"
Get all sites and store them as PS objects in $se_sites:
$se_sites = @()

$pageNum = 0
$anotherPageToFetch = $true

while ($anotherPageToFetch) {
   $pageNum ++
   $sites = get-webApiJson "$baseUrl/sites?pagesize=999&pagenum=$pageNum"
   foreach ($site in $sites.items) {
      $se_sites += new-object psObject -property @{ name = $site.name ; api_name = $site.api_site_parameter ; type = $site.site_type }
   } 
   $anotherPageToFetch = $sites.has_more
}

$se_sites | where-object type -eq main_site
Find questions that contain a specific URL:
$url = 'renenyffenegger.ch'

foreach ($site in $se_sites) {

   if ($site.type -eq 'meta_site') {
      continue
   }

   $site.name

   $questions_linking_to_url = get-webApiJson "$baseUrl/search/advanced?order=desc&sort=activity&url=*$url*&site=$($site.api_name)"
   foreach ($question in $questions_linking_to_url.items) {
      '  {0,-70} {1}' -f $question.title.SubString(0, [Math]::Min($question.title.Length, 70)), $question.link
   }
}

See also

Web APIs

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758206323, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/StackExchange/Web-API/index(82): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78