techie

    How to delete from a tweets micro.blog with powershell

    These were my last three tweets on the blog…and, I think, the last tweets I posted

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&q=source`&offset=0`&limit=3 `
      -Method get -Header $RestMethodHeaders | 
      select -expand items | 
      select -expand properties | 
      select url,content          
    
    url                                                                        content
    ---                                                                        -------
    {https://mattypenny-tweets.micro.blog/2022/12/31/1609327355398443008.html} {Happy new year to you and yours!}
    {https://mattypenny-tweets.micro.blog/2022/12/24/1606763511543209984.html} {God bless us, every one}
    {https://mattypenny-tweets.micro.blog/2022/12/23/1606293329544548352.html} {My word of the day today is 'myrrh'.}
    
    
    

    So, to delete a specific tweet from the micro.blog….

    Set up the headers

    $RestMethodHeaders = @{
        "Authorization" = "Bearer $BlogToken"
    }
    
    

    Delete the ‘happy new year’ one

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&url=https://mattypenny-tweets.micro.blog/2022/12/31/1609327355398443008.html`&action=delete `
      -Method post `
      -Header $RestMethodHeaders
    

    …and abracadbra

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&q=source`&offset=0`&limit=3 -Method get -Header $RestMethodHeaders | select -expand items | select -expand properties | select url,content
    
    
    url                                                                        content
    ---                                                                        -------
    {https://mattypenny-tweets.micro.blog/2022/12/24/1606763511543209984.html} {God bless us, every one}
    {https://mattypenny-tweets.micro.blog/2022/12/23/1606293329544548352.html} {My word of the day today is 'myrrh'.}
    {https://mattypenny-tweets.micro.blog/2022/12/22/1605866305227087873.html} {My word of the day today is 'eggnog'.}