Diving deep into RESTFULL api brought me all the way from my powershell prompt to the intergalactic universe of Star wars.
How to join your favorite science fiction movies and your favorite automation tool, together, in the same prompt!
This is one of these posts, that has been in my “draft box” for so long, that if it could, it would have had grown a beard by now!
Why this module you may ask? Well, if you have been following along, I have been working quite a few with REST API these last months. In case you don’t know what rest api is, It is a very cool technology which allows you to query information stored on HTTP end point by usings HTTP requests. I know, this can sound a bit ‘difficult’, but believe me, it is super easy!
REST has been used more and more by IT pros (Read powershell scripters developpers), especially with Microsoft’s new cloud technolgies. I got to know REST while developping Powershell automation scripts for Sharepoint Online and Office 365.
Quite often when we want to gather data from the internet, we do have a limited set of automation possibilities, us, the PowerShell scripters developpers. Gladly, the cloud is full of REST end points, and we can get our information directly from there.
Ok, and what about this Star Wars PowerShell module?
Well, basically, I was curious what other REST points would be available for us in the cloud. I already knew about Youtube and Facebook, but I was curious. And then I found http://Swapi.co “The star wars API”. As it names suggest, it is a API, which host a Star Wars database accessible through Restless API.
The main drawback of the Swapi.co API is that it doesn’t use ODATA to structure the calls. Which means that there is no well knowed format for queries that is respected, which made things a bit more difficult when I was trying to filter things out.
As soon as I saw that, I open my ISESteroids console, and started to code immediately. Shortly after, I finished the first version of the Posh-StarWars PowerShell module.
Do you want to participate to the posh project? I have made it publicly available on my GitHub account here.
I also would like to point out that all the credits go out to “phalt” who created the initial project and made all of this possible (original project is available here) You can directly access the swapi web site here. I simply wrote Powershell wrappers around the great work from “phalt”
What can the Star Wars PowerShell module do?
Posh-StarWars cmdlets:
This very first version comes with 7 cmdlets.
1
2
3
4
5
6
7
8
9
10
11
|
Get-Command -Module posh-starwars | select name
Name
——
Get-SWFilm
Get-SWObject
Get-SWPeople
Get-SWPlanet
Get-SWSpecies
Get-SWstarship
Get-SWVehicule
|
Each of the cmdlet comes with the same set of parameters:
Leave A Comment