Upload File Attachment v2

post

/jderest/v2/file/upload

Upload a file type media object for the given structure and key. The 'moAdd' parameter takes a JSON string in the form of the MediaObjectUploadRequest class

Request

Supported Media Types
Header Parameters
Form Parameters
Back to Top

Response

Supported Media Types

200 Response

Successful Execution
Body ()
Root Schema : MediaObjectUploadResponse
Type: object
MediaObjectUploadResponse is the response to the upload operation.
Show Source

400 Response

Bad Request - Invalid JSON Input

403 Response

Authorization Failure

415 Response

Invalid Content-Type Header - Must use application/json

444 Response

Invalid Token
Body ()
Root Schema : ServiceErrorResponse
Type: object
Error Response
Show Source

500 Response

Server Failed to Process Request
Body ()
Root Schema : ServiceErrorResponse
Type: object
Error Response
Show Source
Back to Top

Examples

Example Request

The following shows an example of a media object request to upload a file attachment. The token value is from a prior call to the token request service to establish a session. The file being uploaded is in this location: C:\temp\billards.jpg and it is an image/jpeg type. The JSON being sent is stored in this location and text file: C:\temp\upload.json.

curl -i POST "Content-Type:multipart/related" http://ais_server_url/jderest/file/upload  -F file="@C:\temp\billards.jpg;type=image/jpeg" -F moAdd="@C:\temp\upload.json;type=application/json"


Contents of file: C:\temp\upload.json:
{
    "token":"044HcnKxuypi6XVrCAtYtiAKcGHMpd9xA9HukRsiAyJY58=MDE5MDA4NjY0MTUzMTQ5MzQ4OTgxMjUyNk15RGV2aWNlMTQ4MjQzMTEzNTg0NQ==",
    "deviceName":"MyDevice",
    "ssoEnabled":false,
    "moStructure":"ABGT",
    "moKey":[
        "7500"
    ],
    "formName":"P01012_W01012B",
    "version":"ZJDE0001",
    "file":{
        "fileName":"billards.jpg",
        "fileLocation":"C:\\temp\\billards.jpg",
        "itemName":"Uploaded File APIs",
        "sequence":0
    }
}

Example Response

The following example shows the contents of the response body.

{
    "uniquefilename":"FILE-7226089643494364133-1482431140345.jpg",
    "itemName":"Uploaded File APIs.jpg",
    "sequence":2
}
Back to Top