Hi,
Can anyone please help me with the Powershell command for folder creation using API. Below is curl command which is working fine :
curl -X POST “https://ec2amaz-v3qfmb2/odata/Folders” -H “accept: application/json” -H “Content-Type: application/json;odata.metadata=minimal;odata.streaming=true” -d “{"DisplayName":"TestDev","FullyQualifiedName":"Test1234","ProvisionType":"Automatic","PermissionModel":"FineGrained","FeedType":"Processes"}” -H “authorization: Bearer xxxxxxxxxx”
How to convert the above to a powershell command in order for me to create a powershell script ?
Hey @Sumit_Ghosh1
Please find the below,
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer XXXXXXXX")
$headers.Add("Content-Type", "application/json")
$body = "{
`n `"DisplayName`": `"TestDev`",
`n `"FullyQualifiedName`": `"Test1234`",
`n `"ProvisionType`": `"Automatic`",
`n `"PermissionModel`": `"FineGrained`",
`n `"FeedType`": `"Processes`"
`n}"
$response = Invoke-RestMethod 'https://ec2amaz-v3qfmb2/odata/Folder' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Hope this helps.
Thanks
#nK