Creating API help

I am trying to get this API working.

But I dont know why I get this results from the api

{
"UserAgent": {
"status": 200,
"headers": {
"0": "HTTP/2 200",
"server": "nginx/1.24.0 (Ubuntu)",
"date": "Mon, 06 Jan 2025 19:53:05 GMT",
"content-type": "application/json",
"vary": [
"Origin",
"Access-Control-Request-Method",
"Access-Control-Request-Headers"
]
},
"data": {
"userAgentString": "ServerConnect/1.0",
"name": "ServerConnect",
"type": "Special",
"version": "1.0",
"versionMajor": "1",
"build": "Unknown",
"device": {
"name": "Unknown",
"type": "Unknown",
"brand": "Unknown",
"cpu": "Unknown"
},
"engine": {
"name": "Unknown",
"type": "Unknown",
"version": "??",
"versionMajor": "??",
"build": "Unknown"
},
"operatingSystem": {
"name": "Unknown",
"type": "Unknown",
"version": "??",
"versionMajor": "??",
"build": "??"
}
}
},

I get server connect info instead of the browser info. Any idea??

You get server connect info because it's your Server Action that's performing the request, not the user's browser. If you want to get info about the user's browser, you have to pass the user's User-Agent request header to the API, as specified in the documentation of that API.

Alternatively, you can perform the request client-side

2 Likes