Discussions
Unable to post when using a blob audio for talk
I am saving some audio files as blob in the db, but I am unable to post using the API
audio_url: "blob:https://localhost:3000/5d7e2c4a-4dd9-40be-8bde-8c59c114c6c7"
Code:
const options = {
method: "POST",
url: "https://api.d-id.com/talks",
headers: {
accept: "application/json",
"content-type": "application/json",
authorization: API_KEY,
},
data: {
script: {
type: "audio",
audio_url: audioURL,
},
config: { fluent: "false", pad_audio: "0.0" },
source_url: img_url,
},
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
setclipId(response.data.id);
})
.catch(function (error) {
console.error(error);
});
The response I get is:
{
"kind": "ValidationError",
"description": "validation failed",
"details": {
"body.script": {
"message": "Could not match the union against any of the items. Issues: [{"body.script.type":{"message":"should be one of the following; ['text']","value":"audio"},"body.script.input":{"message":"'input' is required"}},{"body.script.audio_url":{"message":"must be a valid https URL to an audio (flac,mp3,mp4,wav,m4a)","value":"blob:https://localhost:3000/5d7e2c4a-4dd9-40be-8bde-8c59c114c6c7\"}}]",
"value": {
"type": "audio",
"audio_url": "blob:https://localhost:3000/5d7e2c4a-4dd9-40be-8bde-8c59c114c6c7"
}
}
}
}