SlideShare a Scribd company logo
PowerShell and REST
Expanding your Horizon
Luc Dekens, PowerShell MVP, vExpert
Bio
• Luc Dekens - Belgium
• PowerShell MVP (2013-2015)
• vExpert (2009-2015)
• Co-author PowerCLI Reference
• LucD on VMware VMTN
• http://lucd.info
• @LucD22
Agenda
• REST
• Cmdlet
• Simple Run
• Issues
• Tools
• Star Wars
REST
• Representational State Transfer
• (Alternative to SOAP)
• Not a protocol, but an architecture !
• Constraints: Client-Server, Stateless, Cacheable,
Layered, Uniform Interface…
• HTTP/HTTPS
• HTTP Verbs (GET, POST, PUT, DELETE…)
• URI (Uniform Resource Identifiers)
• RESTful APIs
REST
Method + Base-Uri + Endpoint
GET https://cloud.ravellosystems.com/api/v1/applications
GET http://whois.arin.net/rest/nets;q=207.46.13.63
Cmdlet
Invoke-RestMethod
• Since PowerShell v3
• Improved in subsequent versions, but still some annoying “issues” present
• Tries to detect the returned datatype + converts (ATOM, XML, JSON, Text)
• Parameters = 23 (PS v5 build 10.0.10586.0) + Common parameters
Cmdlet Parameters
MethodUseBasicParsing
URIWebSession
SessionVariable
Credential
UseDefaultCredentials
CertificateThumbprint
Certificate
UserAgent
DisableKeepAlive
TimeoutSec
HeadersMaximumRedirection
Proxy
ProxyCredential
ProxyUseDefaultCredentials
Body
ContentType
TransferEncoding
Infile
Outfile
Passthru
Authentication CmdletRequest Session
Running the cmdlet 1
• Minimal run
• Default REST Method is Get
• Format of return data
• Filetype-like extension on URI
• Header - ContentType
Running the cmdlet 2
Running the cmdlet 3
• Authentication - Basic
Issues – DateTime 1
• JSON uses Unix epoch (POSIX time)
• Type is long (int64)
• Converting DateTime issue
• DateTime: ScriptProperty (added by ETS)
• DisplayHint: NoteProperty (added by Get-Date)
Issues – DateTime 2
• Solution 1
Issues – DateTime 3
• Solution 2
• Formula: convert to UTC, subtract “01/01/70 00:00”
• … and back
Issues – Depth 1
• ConvertTo-Json : default Depth is 2 !
Issues – Status
• Invoke-RestMethod only returns data
• Status/Error code is not included
Tools 1
• The REST API Reference for the application
• Come in all sizes and formats
Tools 2
• A simulator
• Advanced REST Client for Chrome
Tools 3
• A Capturing Tool
• Fiddler4
• PostMan
Tools 4
• Send script REST API traffic through Fiddler4
Tools 5
• Keep track of what you are implementing (think module)
Star Wars 1
Star Wars 2
Why REST
• It’s (relatively) easy !
• Many vendors/products offer a Restful API
• MSFT: Azure, Exchange, SharePoint…
• VMW: vRealize Suite
• EMC: Avamar
• … and many more
• Common (most of the time) methodology
• To watch (?): Odata + OAuth2
References
• Invoke-Restmethod
• RESTful API Tutorial
• RESTful Web services: The basics
• API Directory
• GitHub
Q&A

More Related Content

PPTX
ASP.NET vNext
PPTX
.NET Standard - Introduction
PDF
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
PPTX
Run your Dockerized ASP.NET application on Windows and Linux!
PDF
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
PDF
Finally, easy integration testing with Testcontainers
PDF
Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...
 
PPTX
JavaEdge 2008: Your next version control system
ASP.NET vNext
.NET Standard - Introduction
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
Run your Dockerized ASP.NET application on Windows and Linux!
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
Finally, easy integration testing with Testcontainers
Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...
 
JavaEdge 2008: Your next version control system

What's hot (20)

PDF
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
PPTX
ASP.NET Core Demos
PDF
Securing Containers From Day One | null Ahmedabad Meetup
PPTX
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
PDF
GWT Enterprise Edition
PDF
8th Athens Big Data Meetup - 1st Talk - Riding The Streaming Wave DIY Style
PDF
WSO2Con USA 2015: Carbon 5: A Preview
 
PPTX
ASP.NET Core Demos Part 2
PDF
MuleSoft Manchester Meetup #3 slides 31st March 2020
PPTX
Mutating Admission Webhook creation
PDF
Productivity Acceleration Tools for SOA Testers
 
PPTX
5 Popular Choices for NoSQL on a Microsoft Platform - All Things Open - Octob...
PDF
2019 hashiconf consul-templaterb
PPTX
.Net Core Fall update
PPTX
Containers: Anti Pattern
PPTX
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
PPTX
IE WebGL and Babylon.js (Web3D 2014)
PDF
OSDC 2018 | Monitoring Kubernetes at Scale by Monica Sarbu
PDF
Creating a Kubernetes Operator in Java
PDF
Advanced process migration with Flowable
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
ASP.NET Core Demos
Securing Containers From Day One | null Ahmedabad Meetup
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
GWT Enterprise Edition
8th Athens Big Data Meetup - 1st Talk - Riding The Streaming Wave DIY Style
WSO2Con USA 2015: Carbon 5: A Preview
 
ASP.NET Core Demos Part 2
MuleSoft Manchester Meetup #3 slides 31st March 2020
Mutating Admission Webhook creation
Productivity Acceleration Tools for SOA Testers
 
5 Popular Choices for NoSQL on a Microsoft Platform - All Things Open - Octob...
2019 hashiconf consul-templaterb
.Net Core Fall update
Containers: Anti Pattern
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
IE WebGL and Babylon.js (Web3D 2014)
OSDC 2018 | Monitoring Kubernetes at Scale by Monica Sarbu
Creating a Kubernetes Operator in Java
Advanced process migration with Flowable
Ad

Viewers also liked (9)

KEY
PowerShell and the Future of Windows Automation
PPTX
Meet Windows PowerShell
PPTX
Ive got a powershell secret
PPT
PowerShell Technical Overview
DOCX
Managing Web Infrastructure Systems with Windows PowerShell 2.0 Demo Script
PPTX
Power shell training
PDF
Powershell notes
PPTX
BSidesLV 2016 - Powershell - Hunting on the Endpoint - Gerritz
ODP
An Introduction to Windows PowerShell
PowerShell and the Future of Windows Automation
Meet Windows PowerShell
Ive got a powershell secret
PowerShell Technical Overview
Managing Web Infrastructure Systems with Windows PowerShell 2.0 Demo Script
Power shell training
Powershell notes
BSidesLV 2016 - Powershell - Hunting on the Endpoint - Gerritz
An Introduction to Windows PowerShell
Ad

Similar to BePUG - PowerShell and REST - Expanding your Horizon (20)

PPTX
Vincent biret azure functions and flow (toronto)
PPTX
Vincent biret azure functions and flow (ottawa)
PPT
David buksbaum a-briefintroductiontocsharp
PPTX
SPS calgary 2017 introduction to azure functions microsoft flow
PPTX
Exploring Twitter's Finagle technology stack for microservices
PDF
Into The Box 2020 Keynote Day 1
PPTX
SOA Doing Right
PPTX
Powering up on PowerShell - BSides Greenville 2019
PPTX
CloudFest 2018 Hackathon Project Results Presentation - CFHack18
PPTX
05 integrate redis
PPTX
Meteor Boulder meetup #1
PPTX
PUG Challenge 2016 - The nativescript pug app challenge
PPTX
Social Photos - My presentation at Microsoft Tech Day
PPTX
.NET7.pptx
PPTX
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
PDF
Versioning for Developers
PPTX
Cont0519
PDF
Raffaele Rialdi
PDF
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
 
PDF
What we do with Go
Vincent biret azure functions and flow (toronto)
Vincent biret azure functions and flow (ottawa)
David buksbaum a-briefintroductiontocsharp
SPS calgary 2017 introduction to azure functions microsoft flow
Exploring Twitter's Finagle technology stack for microservices
Into The Box 2020 Keynote Day 1
SOA Doing Right
Powering up on PowerShell - BSides Greenville 2019
CloudFest 2018 Hackathon Project Results Presentation - CFHack18
05 integrate redis
Meteor Boulder meetup #1
PUG Challenge 2016 - The nativescript pug app challenge
Social Photos - My presentation at Microsoft Tech Day
.NET7.pptx
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Versioning for Developers
Cont0519
Raffaele Rialdi
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
 
What we do with Go

Recently uploaded (20)

PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Digital Strategies for Manufacturing Companies
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
AI in Product Development-omnex systems
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
medical staffing services at VALiNTRY
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Digital Strategies for Manufacturing Companies
Reimagine Home Health with the Power of Agentic AI​
Navsoft: AI-Powered Business Solutions & Custom Software Development
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
wealthsignaloriginal-com-DS-text-... (1).pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
How to Migrate SBCGlobal Email to Yahoo Easily
PTS Company Brochure 2025 (1).pdf.......
Upgrade and Innovation Strategies for SAP ERP Customers
Odoo Companies in India – Driving Business Transformation.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Nekopoi APK 2025 free lastest update
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
AI in Product Development-omnex systems
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
VVF-Customer-Presentation2025-Ver1.9.pptx
medical staffing services at VALiNTRY

BePUG - PowerShell and REST - Expanding your Horizon