Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell - Rest API with XML output

$
0
0

Good morning guys,

I have a simple REST API call that returns XML but for the life of me I can't figure out why the file is coming back empty.

My code:

$key = "&key=b8dedadf7bf2554b636XXXXXXXa42a27affd2a"
$filter = "?status_id=1"
$url = "http://server:3000/redmine/users.xml" + $filter + $key

Invoke-RestMethod $url | out-file "T:\temp\test.xml"

When I run it the file will just contain:

xml                                                                                                        users                                                                                                     
---                                                                                                        -----                                                                                                     
version="1.0" encoding="UTF-8"                                                                             users       

But no other information.

If I issue the REST call into the browser directly,  I get nice clean XML response with all the information I need.

Obviously I am doing something wrong in Powershell but I can't figure it out!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>