Author Topic: REST Multipart/form with embedded zip  (Read 533 times)

tdallmann

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
REST Multipart/form with embedded zip
« on: December 08, 2017, 06:01:13 PM »
Hello - I've been trying to use the examples but am having trouble.  I have a site I need to work with where I perform several REST calls in PowerShell.  All of them use OAuth1 for authentication.  The set of calls I need to make include one where I am sending a zipped file as part of a multipart/form message.  I have this working via raw Powershell, but for various reasons I am looking for a published library to use instead.

As an example, when I use PostMan to make the call, it looks like this:

POST /one/oauth1/cms/v5/import/prepare HTTP/1.1
Host: na4.smartcommunications.cloud
Accept: application/xml, application/json
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: OAuth oauth_consumer_key="myconumerkey%21myusername",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1512773150",oauth_nonce="d9TAhVfPOxh",oauth_signature="generatedsignature"
Cache-Control: no-cache
Postman-Token: d7046cad-c7cd-9869-9be5-5e3dd082fd84

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="myfile.zip"
Content-Type: application/x-zip-compressed


------WebKitFormBoundary7MA4YWxkTrZu0gW--

I followed the example at https://www.example-code.com/powershell/rest_multipart_form_data.asp, but seem to be having trouble embedding the zip file into the message.   Looking for a way to get this working...

Thanks!