on 04-22-2010 6:56 PM
Using the Integration API , I'm trying to upload a file to an activity, yet I always get a 400 error message.
POST https://streamwork.com/v1/activities/JTxjdeK5gmOq7zSvMmvK0U/items?oauth_consumer_key=*****&oauth_token=****&oauth_signature_method=PLAINTEXT&oauth_signature=***%26****&oauth_timestamp=1271956816&oauth_nonce=956049075&oauth_version=1.0
Here are some elements:
- a code review by co-workers did not uncover a problem
- I took the sample code from com.sap.streamwork.activities.Post_NewFileItem
- Posting other kind of items on the same activity works fine.
- the url is signed like the rest of the urls
What is the most likely source of the problem?
Thanks!
Christophe
Here is the actual content of the POST request, minus the binary part.
--mime_boundary
Content-Disposition: form-data; name="SocialProxy - API.pdf"; filename="dummy.xml"
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<item name="SocialProxy - API.pdf">
<description>Uploaded using SAP Workspace</description><file_item/></item>
--mime_boundary
Content-Disposition: form-data; name="file"; filename="SocialProxy - API.pdf"
Content-Type: application/pdf
Content-Transfer-Encoding: binary
(...)
--mime_boundary--
Note: all lines are terminated by \r\n, including the last line.
It looks like the name of the field containing the description xml is wrong, it should be 'item'. You can confirm this by checking the response body, I suspect it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<error>
<http_status>400 Bad Request</http_status>
<message>multipart/form-data format error: expecting a part with name 'item'.</message>
</error>
The first few lines of your POST request should be
--mime_boundary
Content-Disposition: form-data; name="item"; filename="dummy.xml"
Content-Type: application/xml
Hopefully that will fix things.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.