Wowza Community

Wowza Uploading an Assest

Hello I was able to create an asset via fetch on JavaScript, but have been struggling to do a put request with fetch.

curl -X PUT -H ‘Content-Type: video/mp4’ --upload-file file_pathupload_url

What I have so far:

const data = {
asset: {
file_name: “Chukker_old_new_lowres.mp4”
}
}

const filedata = {
video : “Chukker_old_new_lowres.mp4”
}

fetch(“https://api.video.wowza.com/api/v1.8/assets”, {
body: JSON.stringify(data),
headers: {
“Content-Type”: “application/json”,
“Wsc-Access-Key”: “{ACCESS-KEY}”,
“Wsc-Api-Key”: “{API-KEY}”
},
method: “POST”
}).then(res => res.json()).then(data => {
console.log(‘Success’, data.asset.upload_url);
fetch(data.asset.upload_url, {
video: JSON.stringify(filedata),
headers: {
“Content-Type”: video/mp4,
},
method: “PUT”
})
}).catch((error) => {
console.error(‘Error:’, error);
});

Hello and welcome to the community @Matheus_Leal. I am assuming you have contacted sales to have this feature added to your Wowza Video account correct?

You must obtain a license for the Asset Manager to add this capability to your new or existing account. Contact sales@wowza.com for more information.

If you have configured the auth headers correctly and the API call, you should be able to query the API for a status on the upload. It looks though like you are getting a console error, which makes me think this is an account issue.

If it’s not an account issue and you have paid to have this upload asset feature added to your account, please send us a support ticket and we will troubleshoot for you.


You are following this article correct?

https://www.wowza.com/docs/upload-an-asset-with-the-wowza-video-rest-api