Created
September 6, 2016 07:50
-
-
Save darrenjrobinson/c6cce2ce9ab224171233e5b40d3c529a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
write-verbose "Create App Instance" | |
$userAgent = "DR UCWA App" | |
$EndpointID = "75d0449f-aa09-4f5d-add5-eeefc518b337" | |
try{ | |
$postparams = @{UserAgent=$userAgent;EndpointId=$EndpointID;Culture="en-US"} | ConvertTo-JSON | |
$data = Invoke-WebRequest -Uri "$rootappurl" -Method POST -Body "$postparams" -Headers @{"Authorization"="Bearer $authcwt"} -ContentType "application/json" -UseBasicParsing | |
$appurl = $(($data.content | ConvertFrom-JSON)._links.self.href) | |
$appurl = "$($rootappurl.split("/")[0..2] -join "/")$(($data.content | ConvertFrom-JSON)._links.self.href)" | |
$meurl = $(($data.Content | ConvertFrom-JSON)._embedded.me._links) | |
$peopleurl = $(($data.Content | ConvertFrom-JSON)._embedded.people._links) | |
$appid = $appurl.split("/")[-1] | |
$operationID = (($data.content | ConvertFrom-JSON)._embedded.communication | GM -Type Noteproperty)[0].name | |
# Need to allow HTML messages to be posted | |
$postparams = @{"supportedMessageFormats"="Plain","Html"} | ConvertTo-JSON | |
$data = Invoke-WebRequest -Uri "$rootappurl/$appid/communication/makeMeAvailable" -Method POST -Body $postparams -Headers @{"Authorization"="Bearer $authcwt"} -ContentType "application/json" -UseBasicParsing | |
}catch{ | |
write-output "Unable to create application instance" | |
exit 1 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment