umami-software / api-client Goto Github PK
View Code? Open in Web Editor NEWAPI client for Umami Analytics
License: MIT License
API client for Umami Analytics
License: MIT License
Hi,
thank you for your work.
I think the types on getEventDataEvents should get Umami.WebsiteEventData[]
instead of Umami.WebsiteEventData to return a right type?
getEventDataEvents(websiteId: string, params: { startAt: number; endAt: number; event?: string; }): Promise<ApiResponse<Umami.WebsiteEventData[]>>;
So apparently since [email protected]
they're using undici
instead of node-fetch
and that causes this error.
There're plenty of GH issues related and it seems that it's not solved in next 14.0.3.
vercel/next.js#44062
vercel/next.js#54961
I don't know how relevant this issue can be but posting instead someone else’s struggling with client functions like createWebsite
.
In the doc https://umami.is/docs/api-client the userId
var is called UMAMI_API_CLIENT_USER_ID
when it's UMAMI_API_USER_ID
in the code
Line 10 in 2a4ffd4
Linked with #10
It feels like this API client is outdated?
It looks like the extra params on the getWebsiteStats
and getWebsiteMetrics
are not marked as optional.
So in this function
const { data } = await client().getWebsiteStats(websiteId, {
startAt: 1685566800000,
endAt: 1686916052440,
url: '/about'
});
You get this error
Argument of type '{ startAt: number; endAt: number; url: string; }' is not assignable to parameter of type '{ startAt: number; endAt: number; url: string; referrer: string; title: string; query: string; event: string; os: string; browser: string; device: string; country: string; region: string; city: string; }'.
Making a call to this endpoint getWebsiteStats
returns error code 500
const { data } = await client().getWebsiteStats(websiteId, {
startAt: 1685566800000,
endAt: 1686916052440,
});
The same endpoint directly via the REST API works just fine though:
curl --request GET \
--url https://api.umami.is/v1/websites/<website id>/stats \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-umami-api-key: <api key>' \
--data startAt=1685566800000 \
--data endAt=1686916052440
I messaged on discord as well, so you can DM me there if you need my exact website ID for debugging!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.