0% found this document useful (0 votes)
47 views3 pages

File Attachment

The document describes an API endpoint that allows a caller to download a file type media object attachment. The endpoint supports POST requests containing a JSON request body with parameters like the media object key, structure, form name and version. It returns a 200 response with the file contents in the response body, or error responses like 400, 403, 415 for invalid requests. Examples show requesting a billiards image file and saving the output as a .jpg file locally.

Uploaded by

Khawaja Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

File Attachment

The document describes an API endpoint that allows a caller to download a file type media object attachment. The endpoint supports POST requests containing a JSON request body with parameters like the media object key, structure, form name and version. It returns a 200 response with the file contents in the response body, or error responses like 400, 403, 415 for invalid requests. Examples show requesting a billiards image file and saving the output as a .jpg file locally.

Uploaded by

Khawaja Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Download File Attachment v1

POST
/jderest/file/download

Allows the caller to download a file type media object.

Request
Supported Media Types
application/json
Header Parameters
jde-AIS-Auth(optional): string
jde-AIS-Auth-Device(optional): string
Body (MediaObjectDownloadRequest)
Input for request to download a file type media object attachment.
Type: object
Input for request to download a file type media object attachment.
deviceName(optional): string
downloadURL(optional): string
environment(optional): string
formName: string
height(optional): integer(int32)
jasserver(optional): string
moKey: array
moStructure: string
password(optional): string
psToken(optional): string
role(optional): string
sequence: integer(int32)
token(optional): string
username(optional): string
version: string
width(optional): integer(int32)Back to Top
Response
Supported Media Types
application/octet-stream
200 Response
Successful Execution
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 (ServiceErrorResponse)
Type: object
Error Response
errorText(optional): string
exception(optional): string
message(optional): string
timeStamp(optional): string
type(optional): string
userDefinedErrorText(optional): string
500 Response
Server Failed to Process Request
Body (ServiceErrorResponse)
Type: object
Error Response
errorText(optional): string
exception(optional): string
message(optional): string
timeStamp(optional): string
type(optional): string
userDefinedErrorText(optional): stringBack to Top
Examples
Example Media Object Download Request - Output to Text

The following shows an example of a media object request to download a file


attachment. The token value is from a prior call to the token request service to
establish a session.

This example downloads the output to a text file, so you can view the raw output.

curl -i -X POST -H "Content-Type:application/json"


http://ais_server_url/jderest/file/download -d @C:\temp\jsonFile.txt >
c:\temp\billards.txt

Content of the JSON FILE jsonFile.txt:


{

"token":"044aVG5ThVd+4g4/Sn7jiLLCompbz9Ab5dY9Zt0Vj5bra8=MDE5MDEzMzM1NjUwNzA5NzEyNTQ
2Mzc4NDEwLjEzOS4xMTUuNTUxNDgyMjY3OTc4NDY3",
"moStructure": "ABGT",
"moKey": [
"7500"
],
"formName": "P01012_W01012B",
"version": "ZJDE0001",
"sequence": 2
}
Example Media Object Download Output

The following example shows the contents of the response in raw text form.

HTTP/1.1 200 OK
Date: Tue, 20 Dec 2016 21:12:17 GMT
Transfer-Encoding: chunked
Content-Type: application/octet-stream
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Origin: *

ff d8 ff e1 1f fe 45 78 69 66 20 20 49 49 2a 20 08 20 20 20 09 20 0f 01 02 20 06 20
20 20 7a 20 20 20 10 01 02 20 17 20 20 20 80 20 20 20 12 01 03 20 01 20 20 20 01 20
20 20 1a 01 05 20 01 20 20 20 a0 20 20 20 1b 01 05 20 01 20 20 20 a8 20 20 20 28 01
03 20 01 20 20 20 02 20 20 20 32 01

Example Media Object Download Request - Output to File

This example downloads the output to a jpg file to save the actual file locally as
the correct type . The file is saved to the location: c:\temp\image.jpg

curl -X POST -H "Content-Type:application/json"


http://ais_server_url/jderest/file/download -d @C:\temp\jsonFile.txt >
c:\temp\image.jpg

Content of the JSON FILE jsonFile.txt:


{
"token":"044aVG5ThVd+4g4/Sn7jiLLCompbz9Ab5dY9Zt0Vj5bra8=MDE5MDEzMzM1NjUwNzA5NzEyNTQ
2Mzc4NDEwLjEzOS4xMTUuNTUxNDgyMjY3OTc4NDY3",
"moStructure": "ABGT",
"moKey": [
"7500"
],
"formName": "P01012_W01012B",
"version": "ZJDE0001",
"sequence": 2
}

You might also like