Nguyễn Việt Đức created JAMES-3432:
--------------------------------------

             Summary: Upload: Attachment
                 Key: JAMES-3432
                 URL: https://issues.apache.org/jira/browse/JAMES-3432
             Project: James Server
          Issue Type: Improvement
            Reporter: Nguyễn Việt Đức


*Why*?

User want to upload file/files for an account.
 How?

*Request*
 To upload a file, the client submits an authenticated POST request to the file 
upload resource - which MUST contain a variable called accountId.
 Sample: "https://jmap.example.com/upload/\{accountId}";

*Response*
 A successful request MUST return a single JSON object with the following 
properties as the response:

{code:java}
*accountId*: Id The id of the account used for the call.

*blobId*: Id The id representing the binary data uploaded. The data for this id 
is immutable. The id only refers to the binary data, not any metadata.

*type*: String The media type of the file (as specified in [@!RFC6838], Section 
4.2) as set in the Content-Type header of the upload HTTP request.

*size*: UnsignedInt The size of the file in octets.
{code}

*Note*

If identical binary content to an existing blob in the account is uploaded, the 
existing blobId MAY be returned.
 Clients should use the blobId returned in a timely manner. Under rare 
circumstances, the server may have deleted the blob before the client uses it; 
the client should keep a reference to the local file so it can upload it again 
in such a situation.
 When an HTTP error response is returned to the client, the server SHOULD 
return a JSON “problem details” object as the response body, as per [@!RFC7807].
 As access controls are often determined by the object holding the reference to 
a blob, unreferenced blobs MUST only be accessible to the uploader, even in 
shared accounts.

*Definition of done*

{code:java}
When bob uploads an attachment
 Then an upload response is sent to him
 And using the blobId specified in the upload response, bob can download that 
attachment
{code}
Write integration tests for it.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to