|
| 1 | +# ITFlow API - PowerShell examples |
| 2 | +# https://itflow.org |
| 3 | + |
| 4 | +# Create credential(s) |
| 5 | + |
| 6 | +# API Key |
| 7 | +$apiKey = "a1wEoh1F3omPhea6" |
| 8 | + |
| 9 | +# Credential decryption key |
| 10 | +$credKey = "JKyA0daoyOv7oKpw" |
| 11 | + |
| 12 | +# Base site URL |
| 13 | +$siteUrl = "https://demo.itflow.org" |
| 14 | + |
| 15 | +# Data |
| 16 | +$body = @" |
| 17 | +{ |
| 18 | + "api_key" : "$apiKey", |
| 19 | + "api_key_decrypt_password" : "$credKey", |
| 20 | + "login_name" : "SRV-03 ILO", |
| 21 | + "login_description" : "Lights out for SRV-03", |
| 22 | + "login_uri" : "https://10.0.0.1", |
| 23 | + "login_uri_2" : "", |
| 24 | + "login_username" : "admin", |
| 25 | + "login_password" : "Passw0rd", |
| 26 | + "login_otp_secret" : "", |
| 27 | + "login_note" : "Very important login entry", |
| 28 | + "login_important" : "0", |
| 29 | + "login_contact_id" : "0", |
| 30 | + "login_vendor_id" : "0", |
| 31 | + "login_asset_id" : "0", |
| 32 | + "login_software_id" : 0, |
| 33 | + "client_id" : "1" |
| 34 | +} |
| 35 | +"@ |
| 36 | + |
| 37 | +# Module / Endpoint |
| 38 | +$module = "/api/v1/credentials/create.php" |
| 39 | + |
| 40 | +# Build URI from defined data |
| 41 | +$uri = $siteUrl + $module |
| 42 | + |
| 43 | +# Request |
| 44 | +# Use Invoke-WebRequest instead to see more info about the request/response |
| 45 | +Invoke-RestMethod -Method Post -Uri $uri -Body $body |
0 commit comments