Coder Social home page Coder Social logo

Comments (4)

aroth avatar aroth commented on July 18, 2024

Hi @rgoldiez -- how far are you getting with this?

from react-native-uploader.

rgoldiez avatar rgoldiez commented on July 18, 2024

@aroth - Thanks for the response. Still stuck.

Here's what I'm sending

{ url: 'https://bots.my.salesforce.com/services/data/v36.0/connect/communities/0DB6100000000KLGAY/chatter/feed-elements',
  files: 
   [ { name: 'feedElementFileUpload',
       filename: 'image.png',
       filepath: 'file:///Users/rgoldiez/Library/Developer/CoreSimulator/Devices/4D36D070-BD5E-4C17-BF64-28331FD9A5DD/data/Containers/Data/Application/ABCFF4C9-C6E1-42E7-990D-8A3377CA2F30/Documents/images/44077641-6762-4CF3-AB27-37BC5021D4A1.jpg',
       filetype: 'image/png' } ],
  method: 'POST',
  headers: 
   { Accept: 'application/json',
     Authorization: 'Bearer [__removed token__]' },
  params: 
   { 'Content-Type': 'application/json; charset=UTF-8',
     subjectId: 'a0561000001fZIlAAM',
     capabilities: { content: { description: 'Test file upload', title: 'image.jpg' } },
     feedElementType: 'FeedItem' } }

I'm getting the follow response back from salesforce.

{
  "errorCode":"POST_BODY_PARSE_ERROR",
  "message":"Binary data included but file attachment information is missing. If providing rich JSON/XML input in multipart REST, make sure to include Content-Type header in the part."
}

Any help is greatly appreciated! Note that I'm able to use this component to upload a user profile attachment to salesforce, but that doesn't required a multipart form message... it's just a simple upload to a REST endpoint.

from react-native-uploader.

rgoldiez avatar rgoldiez commented on July 18, 2024

@aroth - any ideas?

from react-native-uploader.

aroth avatar aroth commented on July 18, 2024

@rgoldiez I've taken on some new work and don't have much time to dig into this specific scenario. It appears that others have had similar issues when posting data to the Salesforce/Chatter API. You can review a few of these here:

https://www.google.com/search?q=%22Binary+data+included+but+file+attachment+information+is+missing%22&oq=%22Binary+data+included+but+file+attachment+information+is+missing%22&aqs=chrome..69i57l2.567j0j7&sourceid=chrome&es_sm=91&ie=UTF-8

It's likely header or param naming issues as other libraries are returning the same response. Or it could be a limitation with this library -- I am not certain. Here is a working code example in Java:

http://salesforce.stackexchange.com/questions/1301/image-upload-to-chatter-post

I think it would be useful to determine what react-native-uploader is generating and compare that to input that the Salesforce API is expecting.

from react-native-uploader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.