Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #cls command clears screen
  2. cls
  3.  
  4. #variables
  5. $path='C:\Users\SpyrosSavvanis\Documents\customers_instances.csv'
  6.  
  7. #create login object
  8. $login = @'
  9. {"@type":"login",
  10. "email":"ciro@aspisid.com",
  11. "password":"Password.123"
  12. }
  13. '@
  14.  
  15. # $apilogin variable contains login API URL
  16. $apilogin = "http://argos-dev-api.azurewebsites.net/api/v1/login"
  17.  
  18. # $token variable contains login token retrieved from login API call
  19. $token = Invoke-RestMethod -Uri $apilogin -Method Post -Body $login -ContentType "application/json" | select -expand data | select -expand token
  20.  
  21. #create authorization object
  22. [HashTable]$headers = @{
  23.  
  24. Authorization="Bearer $token"
  25.  
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. #Import Instance data and store in $Uid variable
  33. $Uid = Import-Csv -path $path
  34.  
  35. echo $Uid
  36. $idList=@()
  37. $counter=0
  38. foreach ($uid_instance in $Uid)
  39. {
  40.  
  41. $uids = $uid_instance.uid_instance
  42. echo $uids
  43. $idList+="$uids"
  44. }
  45. echo $idList
  46. $a = $idList -join ","
  47. echo $a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement