5 Replies Latest reply on Apr 24, 2015 7:43 AM by butch

    osapi.http.post - proxy form post with www-form-urlencoded or multipart/form-data FormData support?

    butch

      Hey Ryan,

       

      We're now utilizing Jives osapi.http.[get/put/post/delete] method with { authz: "signed" } when making API calls to our API services.

       

      I've been using Jive Connects API - Client Application Configuration and API Usage as a reference.

       

      This is working great.  We can now transparently authenticate Jive users with our services.

       

      Unfortunately some of our requests contain file uploads.  One possible solution I came up with was FormData object, but this does not seem to work:

       

      osapiArgs.body = new FormData(document.getElementById("myFormWithFileUpload")) does not work.

       

      osapiArgs.body = JSON.stringify({somedata:1}) works.

       

      I've attempted to set headers such as:

      {

         'Content-Type': ['www-form-urlencoded']

      }

       

      It also looks like the body payload is turned into a JSON object when actually run... So I'm hesitant to think FormData will ever work.

       

      Screenshot from 2015-04-22 14:40:42.png

       

      Any suggestions?