Tuesday, April 21, 2020

Using powershell with UptimeRobots API

I got a chance to test Uptimerobots API with Powershell and I used it with a csv-list of urls with keywords to update my uptimerobot account.
Pretty good stuff where you also can output all your monitors with uptimelogs directly to PowerBI or equivalent.

Code:


To get UptimeRobot status from PowerBI the following queries can be used:

Example 1 - Simple query

let
   body = Text.ToBinary("api_key=#myAPIKey#&format=json&logs=1"),
   Options = [
   Headers=[#"Content-type"="application/x-www-form-urlencoded", #"cache-control"="no-cache"],
   Content=body
   ],
   result = Web.Contents(url, Options)
in
    result


Example 2 - Query using records


let
   content= [
      #"api_key"="#myAPIKey#",
      #"format" = "json",
      #"logs" = "1"
   ],
   query = Text.ToBinary(Uri.BuildQueryString(content)),
   Options = [
   Headers=[
      #"Content-type"="application/x-www-form-urlencoded",
      #"cache-control"="no-cache"],
      Content=query
   ],
   result = Web.Contents(Url, Options)
in
    result
 
Example 3 - Query using json
 
let
   content = "{
  ""api_key"": ""#myAPIKey#"",
  ""format"": ""json"",
      ""logs"": ""1""        
    }",
   query = Text.ToBinary(Uri.BuildQueryString(Json.Document(content))),
   Options = [
   Headers=[
      #"Content-type"="application/x-www-form-urlencoded",
      #"cache-control"="no-cache"],
      Content=query
   ],
   result = Web.Contents(Url, Options)  
in
    result

Tuesday, April 14, 2020

SelfService sitecollections in Sharepoint 2019

With Sharepoint 2019 we now have the ability to allow users to create site collections outside their own mysite themselves. This allows for less administration.
The drawback of this solution is that you can only create managed path sites on primary Alternate Access for webapplication. 
Microsofts documentation leaves some holes in regards to how to activate selfservicing functions with powershell in Sharepoint 2019 so I digged for the related values and found settings below. Most are obvious, one wasn't.


Script below




References:
https://docs.microsoft.com/en-us/sharepoint/sites/configure-self-service-site-creation-in-sharepoint-server-2019

Powershell and Uptimerobot

Uptimerobot can be quite tedious when you need to update many monitors at once. For example say you bought the license for Uptimerobot and n...