How do send the body content type as Forum, Data ?
I know this feels like a very simple question, I bet I am simply not putting the info in the right place
The flow on n8n works and the AP give me an error.
How do send the body content type as Forum, Data ?
I know this feels like a very simple question, I bet I am simply not putting the info in the right place
The flow on n8n works and the AP give me an error.
You could set the header “Content-Type” to “application/x-www-form-urlencoded” and then paste the content in the body like so:
audio_url=url.com&toggle_diarization=true
But AP validates that the body is valid JSON, so the request cannot get through.
Maybe something that can adjusted in a future release.
I gave that a try, still cant get it to work.
Can you show me a screenshot of what it will look like in AP.
Thanks so for much for your help.
This is how it could work, but AP validates the body as valid JSON, which it isn’t. This requires changes in AP to work - or you could use a code snippet, which is a bit more involved.
Here is the actual code; use it at your own risk, and let me know if you need further help.
import qs from 'qs';
import axios from 'axios';
export const code = async (inputs) => {
const options = {
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded',
'x-gladia-key': 'your-key-here'
},
data: qs.stringify(inputs),
url: 'https://api.gladia.io/audio/text/audio-transcription/',
};
axios(options).catch(function (error) {
console.log(error.toJSON());
});
return true;
};
I cant seem to get this work work, your code does not seem to do the job … I feel like maybe I am missing something so so simple …
Here is the code they cave me
import axios from 'axios';
import FormData from 'form-data';
const form = new FormData();
form.append('audio_url', 'http://files.gladia.io/example/audio-transcription/split_infinity.wav');
form.append('toggle_diarization', 'true');
const response = await axios.post(
'https://api.gladia.io/audio/text/audio-transcription/',
form,
{
headers: {
...form.getHeaders(),
'x-gladia-key': '<your api key>'
}
}
);
Any insight would be be helpful.
Here is a test API key : 148a37ba-f282-4df0-a1ae-d168b4486ed2
(I will disable the key in 2 days - and there is a hard limit of 1 hour on that key so it will not do much aside from test lol ; )
Your code sample will not work with AP, because this part must always be present:
export const code = async (inputs) => {
// your code here
return true;
};
So it should look like this
import axios from 'axios';
import FormData from 'form-data';
export const code = async (inputs) => {
const form = new FormData();
form.append('audio_url', 'http://files.gladia.io/example/audio-transcription/split_infinity.wav');
form.append('toggle_diarization', 'true');
const response = await axios.post(
'https://api.gladia.io/audio/text/audio-transcription/',
form,
{
headers: {
...form.getHeaders(),
'x-gladia-key': '<your_api_key>'}});
return true;
};
Make sure to “Add npm package” and enter “axios” and then do the same with “form-data”, so your “package.json” file should look like this
{
"dependencies": {
"form-data": "4.0.0",
"axios": "1.5.1"
}
}
Then click on “Test code”. I just did with your API key, but cannot tell if it succeeded.
I cant seem to get things to work - I hope AP will add seaport for form HTTP calls in an update It will just make my life so much easier.
For now I will just run this call on n8n and wait for some update to roll out.
Thank you so very much for your help.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.