none
Value passed from CURL in JSON format - How to read value and assign to a sting RRS feed

  • Question

  • Hi all

    I manged to read a few posts and edited to powershell profile to remove invoke web request and add native "CURL"

    All is good, but the result i receive back from my CURL command gets outputted in the following format to the screen (stdout? i think)

    IE

    PS C:\Users\Administrator> C:\Users\Administrator\Documents\Untitled9.ps1
    curl :   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    At C:\Users\Administrator\Documents\Untitled9.ps1:2 char:1
    + curl --insecure -X  POST "https://ironman:443/pzapi/auth/login" -H "a ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (  % Total    % ...  Time  Current:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
     
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100    91  100    45  100    46    151    154 --:--:-- --:--:-- --:--:--   306
    {"apiKey":"123456789"}

    So in summary i just get this returned

    {"apiKey":"123456789"}

    How do i assign or manipulate this so i can get just the "123456789" and assign to a string variable? So i can then pass this along later in my script

    Or am i missing something really simple here?


    Steve Winfield

    Tuesday, April 24, 2018 12:05 PM

Answers

All replies