-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I'm trying to use Send-TwitterAccount_UpdateProfileBanner to update my account banner:
$Image = [Convert]::ToBase64String((Get-Content .\TwitterBanner.png -Encoding Byte))
Send-TwitterAccount_UpdateProfileBanner -banner $ImageNaturally, that Image string is HUGE, as I'm trying to send a 1500x500 image (the recommended size for one of these banners) that's 101 KB on disk.
When run, I get back
Get-OAuthParameters : Exception calling "EscapeDataString" with "1" argument(s): "Invalid URI: The Uri string is too long."
At C:\Users\joshuak\Documents\WindowsPowerShell\Modules\PSTwitterAPI\0.0.7\public\Invoke-TwitterAPI.ps1:26 char:24
+ $OAuthParameters = Get-OAuthParameters @OAuthParameters_Params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-OAuthParameters
Invoke-RestMethod : Cannot bind parameter 'Method' to the target. Exception setting "Method": "Cannot convert null to type "Microsoft.PowerShell.Commands.WebRequestMethod" due to enumeration
values that are not valid. Specify one of the following enumeration values and try again. The possible enumeration values are "Default,Get,Head,Post,Put,Delete,Trace,Options,Merge,Patch"."
At C:\Users\joshuak\Documents\WindowsPowerShell\Modules\PSTwitterAPI\0.0.7\public\Invoke-TwitterAPI.ps1:34 char:23
+ Invoke-RestMethod @RestMethod_Params
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Invoke-RestMethod], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Looks like the entire image payload is being encoded as part of the URI... which if my understanding of that class is right is capped at 2048 characters? I've tried halving the size of the image, but it's still too long.
I think that shipping this data up as a JSON body on Invoke-RESTMethod would get it up there (I was playing around with this a little, but mucked up the authentication side of things lol)
Metadata
Metadata
Assignees
Labels
No labels