Skip to main content
Hello,

i am trying to create a new SF user in our sandbox using powershell. When i run the beow script i get the error message : The remote server returned an error: (415) Unsupported Media Type

What am i doing wrong ? (see my script below) :

$URI = $result.instance_url+"/services/data/v38.0/sobjects/user/"

$method = "POST"

 

$Body = @{Username="sbradley@email"

            LastName="Bradley"

            FirstName="Sam"

            Email="EMAIL"

            Alias="sbradley"

            CommunityNickname="sbradley1"

            IsActive="false"

            TimeZoneSidKey="America/Los_Angeles"

            LocaleSidKey="en_US"

            EmailEncodingKey="ISO-8859-1"

            ProfileId="ID"

            LanguageLocaleKey="en_US"

            UserPermissionsMobileUser="false"

            UserPreferencesDisableAutoSubForFeeds="false"

            }

Invoke-RestMethod -URI $URI -Method $method -Body $Body -Headers @{"Authorization" = "OAuth " + $access_token}

I have tried different ways but get the error everytime.

Many thanks in advance

Jerry

 
6 respuestas
  1. 22 sept 2016, 11:30
    Hi Jerry,

    I am really glad that your problem is solved,Kindly mark it as best answer by marking this post as solved so that experts from the community will be able to help on some other posts who are really in need of it.

    Best Regards,

    Nagendra.P