Following these docs with a POST url like
https://api.uploadcare.com/convert/video/?paths=["1ad7abd8-d71e-4b21-b415-56b66a7ea1dd/video/"]&store=1
returns an err detail like: [HTTP 400] "paths" parameter is required.
I see both this mention
paths, an array of UUIDs of your video files to process together with a set of needed params.
and mention of this error
[HTTP 400] "paths" parameter is required.
In case you do not provide any input in the request
Could I get a sanity check please? I am actually not passing the paths parameter?
Alex
(Alex Chernenko)
2
Hi @owenhoskins
Thanks for the question!
The paths
and store
parameters must be passed as JSON in the request’s body instead of query params. Below is a code example for NodeJS request:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.uploadcare.com/convert/video/',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/vnd.uploadcare-v0.5+json',
'Authorization': 'Uploadcare.Simple your_public_key:your_secret_key'
},
body: JSON.stringify({"paths":["c7fce2e3-6d5e-4358-9369-33954d6fa854/video/-/format/mp4/"],"store":1})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
And this one is for Python requests:
import requests
url = "https://api.uploadcare.com/convert/video/"
payload = "{\"paths\": [\"c7fce2e3-6d5e-4358-9369-33954d6fa854/video/-/format/mp4/\"],\"store\": 1}"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/vnd.uploadcare-v0.5+json',
'Authorization': 'Uploadcare.Simple your_public_key:your_secret_key'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text.encode('utf8'))
You can use Postman to generate code snippets for other languages and HTTP clients. See this article for more details:
https://learning.getpostman.com/docs/postman/sending-api-requests/generate-code-snippets/
That was it. Thanks a lot for the quick response and the example code. And the tip about Postman code generation, didn’t know about that one.
Alex
(Alex Chernenko)
4
You’re welcome @owenhoskins