Open Windos opened 5 years ago
Actually, scratch that comment about it being capped at 2048... been playing around and looks like it actually between 64,512 and 65,536 (I was testing in increments of 1024 and really didn't feel like getting more specific than that!)
Look at how I got the DirectMessages to work with a JSON body:
Care to try your own implementation, and see if that fixes the file size limitation?
I stumbled upon that and have been playing around, unfortunately still no luck.
Initially I created a new private function ConvertTo-EscapedDataString
which escapes the data in chunks, but then of course it finally gets to Invoke-RestMethod
and it complains about the length of the final URI.
Then went down the JSON path, and the response back is:
Invoke-RestMethod : {"errors":[{"code":38,"message":"banner parameter is missing."}]}
The documentation for this endpoint and the DM one is subtly different and almost looks like this one won't take JSON.
I've started investigating (after some JS people mentioned it) using 'ContentType' = 'multipart/form-data'... but this is heading in to uncharted territory for me lol.
I'll keep playing.
Ok... don't think multipart is being accepted. Followed @markekraus example from when support for it was being added to PowerShell core.
Still getting parameter missing response.
@Windos have you tried with the latest version?
As in 0.0.7? Yeah, I tried it about 2 months ago. I haven't retried with PS7 and the rest method work that's happened in that space though.
On Fri, 28 Feb 2020 at 10:57, Marc R Kellerman notifications@github.com wrote:
@Windos https://github.com/Windos have you tried with the latest version?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mkellerman/PSTwitterAPI/issues/30?email_source=notifications&email_token=ABVCGCUEVW36JOGSKJIUD7LRFAZMJA5CNFSM4G3NDOS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENGDNNI#issuecomment-592197301, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVCGCSYKIJSKHDJCUWRZWDRFAZMJANCNFSM4G3NDOSQ .
I haven't played with sending images.. :/
I'm trying to use
Send-TwitterAccount_UpdateProfileBanner
to update my account banner:Naturally, 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
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)