[Support]: Use API via JavaScript #11856
Replies: 2 comments 1 reply
-
this is CORS, you can't request data from a host that is different than the one displaying the web page |
Beta Was this translation helpful? Give feedback.
-
@vanseforge I just created a complete Typescript client for Frigate latest version (0.14 beta) If you give it a try let me know how easy/hard it is. I might create a npm package for it Edit: I've published the library in npm https://www.npmjs.com/package/@intruder-detection/frigate-http-api-typescript. The README of the project helps (I hope) to set it up quickly: https://github.com/intruder-detection/frigate-http-api-typescript?tab=readme-ov-file#install import { FrigateHTTPAPI, Events } from '@intruder-detection/frigate-http-api-typescript';
// Set the required configuration
FrigateHTTPAPI.configuration = {
frigateHTTPAPIURL: 'https://192.168.1.223:5000',
};
// Perform any Frigate HTTP API Request
const events = await FrigateHTTPAPI.get(Events.Events, undefined, {
limit: 5,
}); |
Beta Was this translation helpful? Give feedback.
-
Describe the problem you are having
I am trying to fetch some events via the API and get the gif of the events with JavaScript.
My problem is that I get an error: CORS Missing Allow Origin
I used:
const response = await fetch("frigate-ip:port/api/events?labels=person");
If I open the link in the browser, I can see the events as json.
What can I do to get the data?
Version
0.14.0-bccffe6
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
No response
Operating system
Other Linux
Install method
Docker Compose
Coral version
CPU (no coral)
Network connection
Wired
Camera make and model
Any other information that may be helpful
No response
Beta Was this translation helpful? Give feedback.
All reactions