Copy link to clipboard
Copied
This is my matlab code. I am not able to upload the document getting the following error.
StatusLine: 'HTTP/1.1 403 Forbidden'
StatusCode: Forbidden
Header: [1×11 matlab.net.http.HeaderField]
Body: [1×1 matlab.net.http.MessageBody]
Completed: 0
However, using python or postman I can upload the document. There is something wrong with the Matlab script.
Copy link to clipboard
Copied
still looking for help
Copy link to clipboard
Copied
It's hard to grok what you are doing here as I've never used matlab. To be clear, are you able to make the asset, but can't upload it? If so, that's not really an Adobe API issue, but just uploading content in matlab itself.
Copy link to clipboard
Copied
I am really happy to see your kind reply.
Yes, you are right. I am not able to upload it, getting the error "HTTP/1.1 403 Forbidden"
Yes, it is proably matlab issue. I have been stuck here.
Any help in this regard or any wayout in this regard, would be highly appreciated.
Copy link to clipboard
Copied
The best I can do is shared the Node.js code I use for this step:
async function uploadFile(url, filePath, mediaType) {
let stream = fs.createReadStream(filePath);
let stats = fs.statSync(filePath);
let fileSizeInBytes = stats.size;
let upload = await fetch(url, {
method:'PUT',
redirect:'follow',
headers: {
'Content-Type':mediaType,
'Content-Length':fileSizeInBytes
},
duplex:'half',
body:stream
});
if(upload.status === 200) return;
else {
throw('Bad result, handle later.');
}
}
Copy link to clipboard
Copied
I have the python script from the SDK, which is working pretty fine. The problem is with the matlab script, As I posted in thread
Copy link to clipboard
Copied
can you share the correct matlab code. or help me to correct the code, which I posted on the top?
Copy link to clipboard
Copied
I can't, as I don't use Matlab. I'm sorry. Maybe try their support forums?
Copy link to clipboard
Copied
ok, anyway thanks for your time