File Upload

Allows authenticated users to attach files to a document in their library. 

URL

http://www.mendeley.com/oapi/library/documents/<id>/

For group documents:

http://www.mendeley.com/oapi/documents/group/<group id>/<document id>/

Request Method

PUT

Requires Authentication

Yes

Parameters

Required

  • id: Id of the document we want to attach the file to. For new documents, this requires first using the "Create new document" method and using the returned id. For existing documents without a file, simply use the user document id obtained via either the "Library" or "Document details" methods.
  • oauth_body_hash: SHA1 of the file. This requires to be part of the authorization header.
The Content-Disposition header must be present in the request including the filename with the extension. See example.

Returns

  • 201 Created
  • 401 Unauthorized
  • 404 Not Found

Rate Limit

Yes.

Current limit is set to 150 files/hr. This is likely to be increased after a short period of load and usage behavior testing.

Request example

PUT http://api.mendeley.com/oapi/library/documents/3690294671/ HTTP/1.1
Content-Disposition: attachment; filename="test.pdf"

Data: 54686973206973206120746573742e0a

The file hash has to be included in the request authorization header, but excluded from the request signature. We'll add it as the oauth_body_hash:

Authorization: 
 OAuth realm="", 
 oauth_body_hash="0828324174b10cc867b7255a84a8155cf89e1b8b", 
 oauth_version="1.0", oauth_token=<oauth_token>, 
 oauth_nonce="97022657", 
 oauth_timestamp="1299771483", 
 oauth_signature="FCfjywHiZ%2F5FB%2F5wL9XFmJZZbaI%3D", 
 oauth_consumer_key=<consumer_key>, 
 oauth_signature_method="HMAC-SHA1"


Request response

A successful request will return a 201 Created header.


Comments

Developer Forum