E9.2 How to Upload File with /jderest/v2/file/upload

mooiikun

Member
Hello everyone,

I'm having issues to upload .csv file using REST API /jderest/v2/file/upload >
I'm following some steps to upload the files using REST API but I got two error when I tried it.

Error 1:
When I enter the moAdd value as:
{
"token":"044alYXI7F9Ry31jR1+OWi2iVhgzcpNO7wTfplgBYXANPo=MDE5MDEwNTcyOTQ3ODE1ODQ1MDU1NTA1MjM2LjM3LjkyLjMxNjMyMTI0NTQ4NjM2",
"deviceName":"MyDevice",
"ssoEnabled":false,
"moStructure":"ABGT",
"moKey":[
"7500"
],
"formName":"P01012_W01012B",
"version":"ZJDE0001",
"file":{
"fileName":"csv-2021-09-15–17.09.50.csv",
"fileLocation":"C:\\xampp\\htdocs\\uploadfile\\csvfile\\csv-2021-09-15–17.09.50.csv",
"itemName":"Uploaded File APIs",
"sequence":0
}
}

It gave me an error response:

{
"message": "Invalid Token: Please Request a New Token",
"exception": "java.lang.Exception",
"timeStamp": "2021-09-20T16:02:35.566+0700"
}

But I already renew the Token, I don't know how to overcome it.

Error 2:
When I enter the moAdd value as:
{
"moStructure":"ABGT",
"moKey":[
"7500"
],
"formName":"P01012_W01012B",
"version":"ZJDE0001",
"file":{
"fileName":"csv-2021-09-15–17.09.50.csv",
"fileLocation":"C:\\xampp\\htdocs\\uploadfile\\csvfile\\csv-2021-09-15–17.09.50.csv",
"itemName":"Uploaded File APIs",
"sequence":0
}
}

It gave me an error response:

{
"error": "Unknown (non-exception) error trying to upload media object."
}

But the statusCode is 200, I don't know why is it gave me an error

Also, how can I check / where can I check the uploaded files when it's successfully uploaded? I'm sorry I'm new to JDE

Thanks in advance!
 

Scott Beebe

Reputable Poster
The functions are running the server. I would expect all file paths to be relative to the server it is running on. Try putting the file on a network drive that the server has permissions to access. Use the full file path to that file on the network.
 
Call Orchestrations From Excel – The Easy Way to Make the Orchestrator Work for You.
Top