{"id":41,"date":"2012-12-11T10:58:31","date_gmt":"2012-12-11T16:58:31","guid":{"rendered":"http:\/\/www.teamdesk.net\/blog\/2012\/12\/powershell-as-an-interactive-api-playground\/"},"modified":"2012-12-11T10:58:31","modified_gmt":"2012-12-11T16:58:31","slug":"powershell-as-an-interactive-api-playground","status":"publish","type":"post","link":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/","title":{"rendered":"PowerShell as an interactive API playground"},"content":{"rendered":"<style><!--\nkbd, tt { font-size: 9pt; display: block; border: 1px solid #ccc; padding: 0.5em; }\nkbd { background: #eee; }\ntt { background: #006; color: #fff; }\n--><\/style>\n<p>From time to time we encountered situations where we needed to test some API calls and though that interactive playground application would be a nice addition to our API tools. And recently we\u2019ve found a perfect replacement \u2013 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Windows_PowerShell\" target=\"_blank\">Windows PowerShell<\/a>.<\/p>\n<p>PowerShell 2.0 has added <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/hh849841.aspx\" target=\"_blank\"><em>New-WebServiceProxy<\/em><\/a> cmdlet to a set of tools, and that\u2019s all you need to start playing with API. Open PowerShell console and type:<\/p>\n<p style=\"text-align: left;\"><kbd>$api = New-WebServiceProxy -Uri <a href=\"https:\/\/www.teamdesk.net\/secure\/api\/21995\/service.asmx?WSDL\">https:\/\/www.teamdesk.net\/secure\/api\/21995\/service.asmx?WSDL<\/a><\/kbd><\/p>\n<p>Now you can call API methods on <em>$api<\/em> variable. First method, of course, is Login()<\/p>\n<p><kbd>$api.Login(\"anonymous@teamdesk.net\", \"\")<\/kbd><\/p>\n<p>And the next could be, for example<\/p>\n<p><kbd>$api.DescribeApp().Name<\/kbd> <\/p>\n<p>PowerShell will output<\/p>\n<p><tt>API Test<\/tt><\/p>\n<p>Let\u2019s try Query()<\/p>\n<p><kbd>$xml = $api.Query(\"SELECT TOP 1 [Text], [Date] FROM [Test]\")<\/kbd><\/p>\n<p>and see what\u2019s inside<\/p>\n<p><kbd>$xml.Data.r<\/kbd><\/p>\n<p>PowerShell output is<\/p>\n<p><tt>id&nbsp;&nbsp; : 2      <br \/>m&nbsp;&nbsp;&nbsp; : true       <br \/>d&nbsp;&nbsp;&nbsp; : true       <br \/>Text : Test 2       <br \/>Date : 2001-01-01<\/tt><\/p>\n<p>If you prefer to have output in table like format, use <em>Format-Table<\/em> cmdlet<\/p>\n<p><kbd>$xml.Data.r | Format-Table<\/kbd><\/p>\n<p><tt>id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date     <br \/>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----      <br \/>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; true&nbsp;&nbsp;&nbsp;&nbsp; true&nbsp;&nbsp;&nbsp;&nbsp; Test 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2001-01-01 <\/tt><\/p>\n<p>And it\u2019s not limited to queries only \u2013 you can call create\/update operations as well.<\/p>\n<p><kbd>$xml.Data.r.Text = \"Test 1\"   <br \/>$api.Update(\"Test\", $xml)    <br \/><\/kbd><\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From time to time we encountered situations where we needed to test some API calls and though that interactive playground application would be a nice addition to our API tools. And recently we\u2019ve found a perfect replacement \u2013 Windows PowerShell. PowerShell 2.0 has added New-WebServiceProxy cmdlet to a set of tools, and that\u2019s all you [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-tips-tricks"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PowerShell as an interactive API playground - TeamDesk Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell as an interactive API playground - TeamDesk Blog\" \/>\n<meta property=\"og:description\" content=\"From time to time we encountered situations where we needed to test some API calls and though that interactive playground application would be a nice addition to our API tools. And recently we\u2019ve found a perfect replacement \u2013 Windows PowerShell. PowerShell 2.0 has added New-WebServiceProxy cmdlet to a set of tools, and that\u2019s all you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/\" \/>\n<meta property=\"og:site_name\" content=\"TeamDesk Blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-11T16:58:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2024\/01\/logo_og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kirill Bondar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirill Bondar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/\"},\"author\":{\"name\":\"Kirill Bondar\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"headline\":\"PowerShell as an interactive API playground\",\"datePublished\":\"2012-12-11T16:58:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/\"},\"wordCount\":323,\"commentCount\":0,\"articleSection\":[\"Tips &amp; Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/\",\"name\":\"PowerShell as an interactive API playground - TeamDesk Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\"},\"datePublished\":\"2012-12-11T16:58:31+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/powershell-as-an-interactive-api-playground\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell as an interactive API playground\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\",\"name\":\"TeamDesk Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\",\"name\":\"Kirill Bondar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"caption\":\"Kirill Bondar\"},\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/author\\\/kirill-bondar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PowerShell as an interactive API playground - TeamDesk Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell as an interactive API playground - TeamDesk Blog","og_description":"From time to time we encountered situations where we needed to test some API calls and though that interactive playground application would be a nice addition to our API tools. And recently we\u2019ve found a perfect replacement \u2013 Windows PowerShell. PowerShell 2.0 has added New-WebServiceProxy cmdlet to a set of tools, and that\u2019s all you [&hellip;]","og_url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/","og_site_name":"TeamDesk Blog","article_published_time":"2012-12-11T16:58:31+00:00","og_image":[{"width":600,"height":315,"url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2024\/01\/logo_og.png","type":"image\/png"}],"author":"Kirill Bondar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirill Bondar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/#article","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/"},"author":{"name":"Kirill Bondar","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"headline":"PowerShell as an interactive API playground","datePublished":"2012-12-11T16:58:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/"},"wordCount":323,"commentCount":0,"articleSection":["Tips &amp; Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/","url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/","name":"PowerShell as an interactive API playground - TeamDesk Blog","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/#website"},"datePublished":"2012-12-11T16:58:31+00:00","author":{"@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"breadcrumb":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/powershell-as-an-interactive-api-playground\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.teamdesk.net\/blog\/"},{"@type":"ListItem","position":2,"name":"PowerShell as an interactive API playground"}]},{"@type":"WebSite","@id":"https:\/\/www.teamdesk.net\/blog\/#website","url":"https:\/\/www.teamdesk.net\/blog\/","name":"TeamDesk Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.teamdesk.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2","name":"Kirill Bondar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","caption":"Kirill Bondar"},"url":"https:\/\/www.teamdesk.net\/blog\/author\/kirill-bondar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}