cancel
Showing results for 
Search instead for 
Did you mean: 

Upload file - Error 500

Former Member
0 Kudos

Hi,

I'm trying to upload a file to an activity;

I use:

URL:

https://streamwork.com/v1/activities/.../items?oauth_consumer_key=u2026&oauth_token=u2026&oauth_sign...

Headers:


{content-type=multipart/form-data; boundary=myboundry, accept=application/xml, content-length=2720}

Message:


--myboundry
Content-Disposition: form-data; name="item"; filename="item.xml"
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?><item name="My Item Name">  <description>My File uploaded</description>  <file_item/></item>
--myboundry
Content-Disposition: form-data; name="file"; filename="file.jpg"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

blah-blah binary content
--myboundry--

Method: POST

As result I constantly get ResponseCode 500 from the server.

To me it looks quite similar to the example from: https://streamwork.com/api/Trouble_shooting.html

Please, any idea what am I doing wrong ?

Thank you !

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you, Simon for the kind answer;

And just for the records, the reason for the issue is that the POST-ed content should directly start with the string:

--boundary

I started the content with an empty line, and this produced the 500 Internal Server error answer.

The page under:

https://streamwork.com/api/Trouble_shooting.html

is slightly unclear with respect of this aspect.

The content under:

http://wiki.sdn.sap.com/wiki/display/SWAPI/GuidedCodeExamplefortheIntegrationAPI

was btw also helpful.

Cheers !

0 Kudos

Thank you very much for your feedback, it is very helpful for others who run into this problem.

Simon

0 Kudos

I think your MIME request looks fine. Check out the some documentation on multipart MIME, e.g. [this|http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html] one. Also, we do provide an [example|http://wiki.sdn.sap.com/wiki/display/SWAPI/GuidedCodeExamplefortheIntegrationAPI] for uploading data using the Integration API, you might read that one as well. Let us know if you were able to solve your problem.

Cheers

Simon