And because calling REST functions can be a little daunting until you've done it once, here's an example to parse an Excel spreadsheet and create accounts and contacts (solves the "no bulk user load" issue with UMP). This runs as a VB script (file.vbs) on Windows 7. Should work fine on other similar OS versions.
You need to adjust the URL to your UMP instnace, username, password, and path to the excel file for this to work but that should be pretty straight forward.
Oh, and as far as credit goes, there's a lot of material here scraped from other web examples and I appologize in advance for not retaining credit. If you are interested, I did very little to adjust the actual code snippits so dropping an obscure piece into Google will likely take you to where I got the smippit from. The usage and assemply is mine though.
And I left a number of the popup boxes from debugging in place - not sure why but sometimes the REST calls fail if executed too quickly and the delay of having to click the OK button eliminates that. That might be fixed in 8.1 but it's easier to click the OK button than unwind corrupted accounts and contacts.
Option Explicit
Dim WshShell
sub CreateAccount(AccountName, FirstName, LastName, Origins, Site, Email)
Dim restReq, url, userName, password, data, accountIDPath, oParser, accountID
Dim contactID, contactIDPath, a, x
userName = "ZZZZZZZZZZZZ"
password = "ZZZZZZZZZZZZ"
'##########################################
' Create account
url = "https://ump.instance.com/rest/accounts"
data = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?> " & _
"<account> " & _
" <address>Teststreet 42</address> " & _
" <city>Testcity</city> " & _
" <country>TestCountry</country> " & _
" <description>" & Site & "</description> " & _
" <fax>Test Fax no 4711</fax> " & _
" <name>" & AccountName & "</name> " & _
" <origins></origins> " & _
" <phone>Test phone 0815</phone> " & _
" <postalCode>123456</postalCode> " & _
" <state>Teststate</state> " & _
" <webSite>www.testrest.com</webSite> " & _
" </account>"
wscript.echo data
Set restReq = CreateObject("MSXML2.ServerXMLHTTP")
restReq.open "POST", url, false, username, password
restReq.setRequestHeader "Content-Type", "application/xml"
restReq.send data
WScript.echo restReq.responseText
'##########################################
' Get account id for newly created account
accountIDPath = "//account/accountId"
Set oParser = CreateObject("Microsoft.XMLDOM")
oParser.LoadXML restReq.responseText
set accountID = oParser.documentElement.selectSingleNode (accountIDPath )
wscript.echo "New Account ID " & accountID.text
set oParser = nothing
set restReq = nothing
'##########################################
' Associate origins with new account
url = "https://ump.instance.com/rest/accounts/" & accountID.text & "/origins"
data = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?> " & _
"<origins> "
a=split(Origins, ":")
for each x in a
data = data & " <origin>" & x & "</origin> "
next
data = data & " </origins>"
wscript.echo (data)
Set restReq = CreateObject("MSXML2.ServerXMLHTTP")
restReq.open "POST", url, false, username, password
restReq.setRequestHeader "Content-Type", "application/xml"
restReq.send data
'WScript.echo restReq.responseText
set restReq = nothing
'##########################################
' Create contact and associate with account
url = "https://ump.instance.com/rest/contacts"
data = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?> " & _
"<contact> " & _
" <accountId>" & accountID.text & "</accountId> " & _
" <acl>Customer</acl> " & _
" <contactId>0</contactId> " & _
" <firstName>" & FirstName & "</firstName> " & _
" <lastName>" & LastName & "</lastName> " & _
" <loginName>" & AccountName & "</loginName> " & _
" <email>" & Email & "</email> " & _
" <password>Merge123</password> " & _
"</contact>"
'wscript.echo data
Set restReq = CreateObject("MSXML2.ServerXMLHTTP")
restReq.open "POST", url, false, username, password
restReq.setRequestHeader "Content-Type", "application/xml"
restReq.send data
'WScript.echo restReq.responseText
'##########################################
' Get contact id for newly created contact
contactIDPath = "//contact/contactId"
Set oParser = CreateObject("Microsoft.XMLDOM")
oParser.LoadXML restReq.responseText
set contactId = oParser.documentElement.selectSingleNode (contactIDPath )
'wscript.echo "New Contact ID " & contactID.text
set oParser = nothing
set restReq = nothing
end sub
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim objExcel, objWkBook, objSheet, myXlsFile, objRow, nConsecutiveBlankRows
' Get a reference to an Excel Application object:
Set objExcel = CreateObject("Excel.Application")
myXlsFile = "C:\Users\user.name\Desktop\PortalUsers.xlsx"
Set objWkBook = objExcel.Workbooks.Open(myXlsFile)
Set objSheet = objWkBook.Sheets(1)
nConsecutiveBlankRows = 0
For Each objRow In objSheet.Rows
' Check to see if we've reached a row in which
' the first cell is empty. We'll want to ignore
' these and keep track of how many we find in a
' row so we can exit the loop without having to
' spend time going through every single row in
' the spreadsheet:
If objRow.Cells(1, 2).Value = "" or objRow.Cells(1, 1).Value = "account" Then
nConsecutiveBlankRows = nConsecutiveBlankRows + 1
If nConsecutiveBlankRows > 5 Then Exit For
Else
' We found a non-blank row, so reset our counter
nConsecutiveBlankRows = 0
'AccountName, FirstName, LastName, Origins, site, email
CreateAccount objRow.Cells(1, 1).Value, objRow.Cells(1, 2).Value, objRow.Cells(1, 3).Value, objRow.Cells(1, 4).Value, objRow.Cells(1, 5).Value, objRow.Cells(1, 6).Value
End If
next
objWkBook.Close False ' False = "Don't save"
objExcel.Quit
set WshShell = nothing