Hi! I ran into a problem when I was creating a resource on the web side.
I am sending a request with this body to the local host:5173:
{
“ext”: “.mp4”,
“name”: “bruno2.mp4”,
“uri”: “/data/screenly_assets/a9f133f9898a5daebb1c620cd0b0844b.tmp”,
“start_date”: “2025-01-03T09:57:48.753Z”,
“end_date”: “2026-01-03T09:57:48.753Z”,
“duration”: 0,
“mimetype”: “video/mp4”,
“is_enabled”: true,
“is_processing”: true,
“nocache”: false,
“play_order”: 0,
“skip_asset_check”: true
} I getting this -
videos:1 Access to XMLHttpRequest at ‘http://176.123.167.23/api/v2/assets’ from origin ‘http://localhost:5173’ has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
But if I send another exactly the same request to Bruno (an application similar to Postman), everything goes well. I would really appreciate your help
@Nicky, that’s interesting. Here are a few questions for you to answer so that we could rule things out:
Are you using a VPN in your network?
What value did you set for the Content-Type in your request (via Bruno)?
Could you please provide details like screenshots or video recordings showing how you attempted to send a request via the browser? It is recommended to send an API request via an API testing tool (like Postman, Bruno, Insomnia, or cURL if you prefer to do things via CLI).
I’ve been doing calls to POST /api/v2/file_asset and POST /api/v2/assets several times and haven’t experienced an issue.
There’s one thing that I noticed:
When the call to POST /api/v2/assets fails (for instance, due to a non-zero duration being given to the request body), I have to do a request to POST /api/v2/file_asset again, and then do the API call for creating an asset again.
I’m really sorry for long expectation, it’s been really hard two weeks for me and I just haven’t much time to open this project
If I’ve correcly catch your sense, so I tried get it from http://localhost:5173